Home > Archive > PHP SQL > August 2004 > Dynamic menus,MySQL queries and display sorting.
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Dynamic menus,MySQL queries and display sorting.
|
|
| fyrfli 2004-05-14, 10:30 pm |
| Hello there.
I have this piece of code which is supposed to get the menu and
sub-menu items and display them in order. It is the same code for
all menu items. The problem is that the sub-menu items all display
under the first menu item all the time, no matter what. Anyone have
any clues/suggestions?
--------
<table>
<?php
print ("<tr><td><a
href='index.php'>Home</a></td></tr>");
require 'connect.php';
query1 = "select page_name, menu_sh_desc from menuz";
query2 = "select page_name, prose_sh_desc from
muzingz";
result1 = mysql_query(query1) or
die("Query failed : " . mysql_error() .
" n");
result2 = mysql_query(query2) or
die("Query failed : " .
mysql_error() .
" n");
while (line1 =
mysql_fetch_array(result1))
{
print ("<tr><td><a
href=line1['page_name']>line1['menu_sh_desc']</a></td></tr>");
if
(line1->menu_sh_desc = "Muzings")
{
while (line2 =
mysql_fetch_array(result2))
{
print ("<tr><td
align='center'><a
href=line2['page_name']>line2['prose_sh_desc']</a></td></tr>");
};
};
};
mysql_free_result( result1 );
mysql_free_result( result2 );
?>
</table>
--------
----------------------------------------
The post
originated from PHP Freaks:
----------------------------------------
http://www.phpfreaks.com
http://www.phpfreaks.com/forums
| |
|
|
|
|
|