Well... There are 4 things that I can see at first glance:
1. Your include() statement is outside of the php tags - you should put the include() inside the <?php ?> tags:
Code:
include("dbc.php");
2. Next, your while statement - $subcategory = $row['name'] is going to rewrite itself each time through the loop. You should try putting it into an array for example - $arr_subcategory[] = $row['name'] - then loop through the array to display, or just echo the $subcategory right in the while loop:
Code:
$query_sub = "SELECT * FROM webstructure WHERE level_category = '$title' AND level = '3' ORDER BY name DESC LIMIT 10";
$result_sub = mysql_query($query_sub)
or die("Invalid query: " . mysql_error());
while ($row=mysql_fetch_array($result_sub)) {
$subcategory = $row['name'];
?>
3. The next while statement - again $category is going to be overwritten each time through the loop, you should assign it to $arr_category[] to create an array:
Code:
$query_sub = "SELECT * FROM webstructure WHERE level = '2' ORDER BY name ASC";
$result_sub = mysql_query($query_sub)
or die("Invalid query: " . mysql_error());
while ($row2=mysql_fetch_array($result_sub)) {
$category = $row2['id'];
4. Finally, I see a problem with the if statement - $subcategory will ALWAYS be equal to $subcategory as you are comparing it to itself.. For example, you are saying if 1 = 1 then echo 1. You need to compare it to something that is a different variable.
Code:
if ($subcategory == $subcategory) echo "$subcategory </td>";
If I am off course here, just let me know and we'll see what we can do.
Last edited by jim.thornton; 06-24-2006 at 11:47 PM..
|