PHP/MySQL driven menu
- 
				Googolplex
 - Super Advanced

 - Posts: 50
 - Joined: Tue Nov 05, 2002 9:09 pm
 
PHP/MySQL driven menu
Does anyone have an example of a PHP/MySQL driven menu ?
			
			
									
						
										
						Take a look at the main site at http://milonic.com/ (I know, you can't see the code, but you'll see some of what can be done), and/or do a search for those items. You will find a lot of stuff. Many folks here using that combo.
			
			
									
						
							John
			
						- 
				Googolplex
 - Super Advanced

 - Posts: 50
 - Joined: Tue Nov 05, 2002 9:09 pm
 
- 
				Googolplex
 - Super Advanced

 - Posts: 50
 - Joined: Tue Nov 05, 2002 9:09 pm
 
this might help
this is what is on the page where i have my menu
this is what is in my menu_data.php page
thats the code i developed my database is set up as 
id,menuname,text,url,showmenu
if you want i can export my menu table from my data base for yeah so you can import it to yours for instant table setup[/code]
			
			
									
						
							this is what is on the page where i have my menu
Code: Select all
$sql = "SELECT * FROM menu WHERE menuname = 'mainmenu'";
    	    $result = mysql_query($sql);
			while ($row = mysql_fetch_row($result))  {
				if ($row[4] != ""){ //row[4] = showmenu, if showmenu!="" then
					echo "<a href=\"$row[3]\" class=\"menu\" onmouseover=\"popup('$row[4]',1)\" onmouseout=popdown()>$row[2]</a>\n";
				}
				else { //row[4] = showmenu, if showmenu="" then 
					echo "<a href=\"$row[3]\" class=\"menu\">$row[2]</a>\n";
				}
			}
Code: Select all
<?
	$connect = mysql_connect("localhost","root","") or die("Unable to connect to your newbish db");
	$db = mysql_select_db("prairies", $connect);   
?>
_menuCloseDelay=500           // The time delay for menus to remain visible on mouse out
_menuOpenDelay=150            // The time delay before menus open on mouse over
_followSpeed=5                // Follow scrolling speed
_followRate=40                // Follow scrolling Rate
_subOffsetTop=10              // Sub menu top offset
_subOffsetLeft=-10            // Sub menu left offset
_scrollAmount=3               // Only needed for Netscape 4.x
_scrollDelay=20               // Only needed for Netcsape 4.x
with(menuStyle=new mm_style()){
onbgcolor="#EDEDED";
oncolor="#000000";
offbgcolor="#3D3D3D";
offcolor="#E5E5E5";
padding=1;
fontsize=11;
fontstyle="normal";
separatorsize=10;
separatorcolor="#3D3D3D";
fontfamily="Arial Narrow";
subimage="images/arrow.gif";
overfilter="Fade(duration=0.2);Alpha(opacity=90);Shadow(color='#777777', Direction=135, Strength=5)";
outfilter="randomdissolve(duration=0.3)";
}
<?
	function makedb($row){
		echo "with(milonic=new menuname(\"$row[1]\")){\n";
		echo "style=menuStyle;\n";
		echo "overflow=\"scroll\";\n";			
		$sql2 = "SELECT * FROM menu WHERE menuname = '$row[1]'";
	    $result2 = mysql_query($sql2);				
		while ($row = mysql_fetch_row($result2))  {
			if($row[4] == "" && $row[3] != ""){
				echo "aI(\"text=$row[2];url=$row[3];\");\n";
			} elseif ($row[4]!="" && $row[3] != "") {
				echo "aI(\"text=$row[2];url=$row[3];showmenu=$row[4];\");\n";
			} elseif ($row[4]!="" && $row[3] = "") {
				echo "aI(\"text=$row[2];showmenu=$row[4];\");\n";
			}
		}
		echo "}\n";
	}	
	$dbname = "mainmenu";
	$sql = "SELECT * FROM menu WHERE menuname != 'mainmenu'";
	$result = mysql_query($sql);
	$nrows = mysql_num_rows($result);
	while($row = mysql_fetch_row($result)){	
		if(strstr($dbname,$row[1])){
		}
		else{ 
			makedb($row);
			$dbname.= ",".$row[1];
		}
							
	}
?>
drawMenus();
id,menuname,text,url,showmenu
if you want i can export my menu table from my data base for yeah so you can import it to yours for instant table setup[/code]
_shft.void(7)
			
						Try this, not sure if it's what you want or will be helpful.
I think that's asp_mysql, but it may help with what you want.
Ruth
			
			
									
						
										
						I think that's asp_mysql, but it may help with what you want.
Ruth


