网页制作时候用php调用mysql做导航菜单问题
mysql_select_db("yzgl",$link);$query="selectid,mname,mename,mnumber,murlfrombmenuorde...
mysql_select_db("yzgl", $link); $query="select id,mname,mename,mnumber,murl from bmenu order by mnumber asc"; $rs = mysql_query($query, $link); if(!$rs){die("Valid result!");} while($row = mysql_fetch_array($rs,MYSQL_NUM)) echo "<tr>$row[1]</tr>"; //显示数据 $list_nav_id = $row[0]; $list_nav_mname = $row[1] ; $list_nav_mename = $row[2] ; $list_nav_mnumber = $row[3] ; $list_nav_murl = $row[4] ; if(substr($list_nav_murl,4)=="http"){ echo "<li><a href=\"".$list_nav_murl."\" target=\"_blank\" title=\"".$list_nav_mname."\">".$list_nav_mname."</a></li>"."\r\n" ; }else{ if($The_page_id==$list_nav_id){ echo "<li><a href=\"".$config["mypath"]."/".$list_nav_mename.".php\" class=\"n\" title=\"".$list_nav_mname."\">".$list_nav_mname."</a></li>"."\r\n" ; }else{ echo "<li><a href=\"".$config["mypath"]."/".$list_nav_mename.".php\" title=\"".$list_nav_mname."\">".$list_nav_mname."</a></li>"."\r\n" ; }
展开
1个回答
展开全部
mysql_select_db("yzgl", $link); $query="select id,mname,mename,mnumber,murl from bmenu order by mnumber asc"; $rs = mysql_query($query, $link); if(!$rs){die("Valid result!");} while($row = mysql_fetch_array($rs)) if(substr($row["murl"],4)=="http"){ echo "<li><a href=\"".$row["murl"]."\" target=\"_blank\" title=\"".$row["mname"]."\">".$row["mname"]."</a></li>"."\r\n" ; }else{ if($The_page_id==$list_nav_id){ echo "<li><a href=\"".$config["mypath"]."/".$row["mename"].".php\" class=\"n\" title=\"".$row["mname"]."\">".$row["mname"]."</a></li>"."\r\n" ; }else{ echo "<li><a href=\"".$config["mypath"]."/".$row["mename"].".php\" title=\"".$row["mname"]."\">".$row["mname"]."</a></li>"."\r\n" ; } 补充: $list_nav_id = $row[0]; $list_nav_mname = $row[1] ; $list_nav_mename = $row[2] ; $list_nav_mnumber = $row[3] ; $list_nav_murl = $row[4] ; 可以
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询