0

Hello everybody,
So this might seem like a really simple thing to some of you more advanced people but it has me extremely stumped, currently I am trying to create a menu.

What I have is a mySQL database with a row called page_name I have written the following code:

<?php
/**
 * This is the main menu
 */
$result = mysql_query( "SELECT page_name FROM ms_content" )
	or die(mysql_error()); 
$num_rows = mysql_num_rows($result);
while ($get_info = mysql_fetch_row($result)){
	echo ".:";
	foreach ($get_info as $mainmenu);
	echo "</br>";}


?>

On my template page I have

<?php echo $mainmenu ?>

Now part of this is working, see I have 8 columns of information in the page_name row which is repeating the ".:" 8 times....yay that works but the problem is is that it isn't showing up where I desire it to show up at and that only one page_name is appearing.

I am curious what I am doing wrong - what makes this tricky and maybe is confusing my young newbie mind is that the $mainmenu is being called on a separate page.

Thank you for the help!

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by urtrivedi
0
$result = mysql_query( "SELECT page_name FROM ms_content" )
	or die(mysql_error()); 
$num_rows = mysql_num_rows($result);
$mainmenu="";
while ($get_info = mysql_fetch_row($result))
{	
        $mainmenu .= ".:";	
        $mainmenu .= $get_info[0];
        $mainmenu .= "</br>";
}

Edited by urtrivedi: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.