I am STUPID with PHP/MySql --- PLS HELP

Discussion in 'PHP' started by StefanRSA, Nov 3, 2008.

  1. #1
    I have two tables. One is categories. The Other is subcategories.
    I want to categorize all the subcategories under the categories...

    Please look at my code and tell me what I am doing wrong.

    My Code at this stage....

    $result = mysql_query(
    "SELECT * FROM ".$prefix."adcat 
    JOIN adsubcat ON adsubcat.catid=adcat.id
    
    ORDER by sortorder,id"
    ) 
    or died("Record NOT Found: ".mysql_error());
    ?>
    <center>
    <div id="wrapper">
    <?
    
    
    while ($db = mysql_fetch_array($result)) {
    echo "<div id =".$db[div].">".$db[name]."<br><div id=".$db[divsub].">".$db[subname]."</div></div>";
    }
    ?>
    Code (markup):
    [​IMG]

    Please HELP???!!!
     
    StefanRSA, Nov 3, 2008 IP
  2. ads2help

    ads2help Peon

    Messages:
    2,142
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    0
    #2
    i duno whats the error u get? and i duno if this is the solution but

    or died("Record NOT Found: ".mysql_error());
    Code (markup):
    shouldn't it be:

    or die("Record NOT Found: ".mysql_error());
    Code (markup):
     
    ads2help, Nov 3, 2008 IP
  3. StefanRSA

    StefanRSA Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi Raider.

    If you look at the image you will see what my code is doing now. I want example Vacant Land,Rentals and all the property related sub categories to be in the PROPERTY block and so on...

    My script works but it wrong for what I want to do
     
    StefanRSA, Nov 3, 2008 IP