Jump to content

Dynamic Menu


seran128

Recommended Posts

I have a table that holds values for a menu I then have a function that I call that build that menu
I want to add a  |  between the values so the menu looks like

item1 | item2 | item3 | item4 ........


[code]function getmenu(){
global $connection;

$sql=mysql_query("SELECT * from menu order by sort_order") or die(mysql_error());

while($row=mysql_fetch_array($sql)) {
$getmenu .= stripslashes($row['title']);


}

return $getmenu;
}

?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/27274-dynamic-menu/
Share on other sites

I figured it out

[code]function getmenu(){
global $connection;

$sql=mysql_query("SELECT * from menu order by sort_order") or die(mysql_error());


$getmenu .= "<table width='100%' border='0'><tr><td><span class='copy'>&nbsp;&nbsp;&nbsp;&nbsp;";

while($row=mysql_fetch_array($sql)) {
$getmenu .= "<a href=javascript:menulink(" . $row['ID'] . ")>" . stripslashes($row['title']) . "&nbsp;|&nbsp;&nbsp;";
}

$getmenu .= "</span></td></table>";


return $getmenu;
}[/code]
Link to comment
https://forums.phpfreaks.com/topic/27274-dynamic-menu/#findComment-124733
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.