Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: MySQL , PHP Database (for forums) wont work  (Read 3496 times)

0 Members and 1 Guest are viewing this topic.

Bannana97

    Topic Starter


    Intermediate
  • Owner of HerbertsWorld Corporation
    MySQL , PHP Database (for forums) wont work
    « on: July 23, 2009, 11:51:33 AM »
    All it does is display 1 thread.
    Heres the database:

    >forums > topics
    >> forum_title
    >> forum_id
    >> forum_section
    >> forum_views
    >> forum_replies
    >> forum_creator
    >> forum_sticky

    But for some reason, when theres already something in the database, it doesnt post it.
    Heres what I think it is

    > forums > topics
    > forum_sticky (2 rows of 0)


    But heres the code:


    Code: [Select]
    for($x=1;$x<=$rn;$x++) {
    require "Database/connect.php";
    $q = mysql_query("SELECT * FROM topics WHERE forum_id='$x'");
    while($q = mysql_fetch_array($q)) {
    if($q['forum_sticky'] == "0") {
    if($q['forum_section'] == $_GET['ID']) {
    echo "
    <tr style='background-color:#D4E4F4;'>
    <td><span style=\"height:15px;width:100%;font-weight:bold;font:12px/1.2 Tahoma, Verdana, Arial;padding:3px;margin:4px;font-weight:bold;\">".$q['forum_title']."</span></td>
    <td><span style=\"height:15px;width:100%;font-weight:bold;font:12px/1.2 Tahoma, Verdana, Arial;padding:3px;margin:4px;font-weight:bold;\">".$q['forum_creator']."</span></td>
    <td><span style=\"height:15px;width:100%;font-weight:bold;font:12px/1.2 Tahoma, Verdana, Arial;padding:3px;margin:4px;font-weight:bold;\">".$q['forum_replies']."</span></td>
    <td><span style=\"height:15px;width:100%;font-weight:bold;font:12px/1.2 Tahoma, Verdana, Arial;padding:3px;margin:4px;font-weight:bold;\">".$q['forum_views']."</span></td>
    </tr>";
    }
    }
    }
    }

    Just fixed width problems....
    « Last Edit: July 24, 2009, 02:48:59 AM by kpac »
    Thanks
    Bannana97

    Rob Pomeroy



      Prodigy

    • Systems Architect
    • Thanked: 124
      • Me
    • Experience: Expert
    • OS: Other
    Re: MySQL , PHP Database (for forums) wont work
    « Reply #1 on: July 24, 2009, 02:38:23 AM »
    I honestly have no idea what you're asking.
    Only able to visit the forums sporadically, sorry.

    Geek & Dummy - honest news, reviews and howtos

    kpac

    • Web moderator
    • Moderator


    • Hacker

    • kpac®
    • Thanked: 184
      • Yes
      • Yes
      • Yes
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 7
    Re: MySQL , PHP Database (for forums) wont work
    « Reply #2 on: July 24, 2009, 02:51:32 AM »
    You're not creating your own forum, are you?

    Quote
    require "Database/connect.php";
    That probably won't work, depending on the server config.

    Try this:

    Code: [Select]
    require(dirname(__FILE__) . "/Database/connect.php");

    Bannana97

      Topic Starter


      Intermediate
    • Owner of HerbertsWorld Corporation
      Re: MySQL , PHP Database (for forums) wont work
      « Reply #3 on: August 01, 2009, 07:47:04 AM »
      Yes, I made my own forums. And I just used math to do this one.
      And guess what? I built it in a week.. Sadly, I didn't have sql injection protection, and it was injected :(

      But, I do now :D
      Thanks
      Bannana97

      kpac

      • Web moderator
      • Moderator


      • Hacker

      • kpac®
      • Thanked: 184
        • Yes
        • Yes
        • Yes
      • Certifications: List
      • Computer: Specs
      • Experience: Expert
      • OS: Windows 7
      Re: MySQL , PHP Database (for forums) wont work
      « Reply #4 on: August 01, 2009, 10:11:41 AM »
      Quote
      Sadly, I didn't have sql injection protection, and it was injected
      By who?

      And, and if you're really serious about this site, I'd recommend removing the item on the front page "Free domain name", since you don't actually offer a free domain name.