mike16889 Posted March 6, 2008 Share Posted March 6, 2008 im build a script to display a simple menu that is stored in a database. Here's the code: <link href="../FP_Themes/FP_Defualt/style.css" rel="stylesheet" type="text/css" /> <?php include('../FP_config.inc.php'); mysql_connect($FP_dbserver,$FP_username,$FP_password); @mysql_select_db(fpmm0_3) or die( "Unable to select database"); $query="SELECT * FROM fp_menu"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); echo '<table border="0" width=198>'; $i=0; while ($i < $num) { $mtitle=mysql_result($result,$i,"title"); $murl=mysql_result($result,$i,"url"); $mHS=mysql_result($result,$i,"HS"); echo ' <tr> <td width="100%"><a href="$murl" class="menulink" class=&{ns4class};>$mtitle</a></td> </tr>'; $i++; } echo ' </table>'; ?> but for some reason its not printing the values of the veriables just the veriable names eg: <link href="../FP_Themes/FP_Defualt/style.css" rel="stylesheet" type="text/css" /> <table border="0" width=198> <tr> <td width="100%"><a href="$murl" class="menulink" class=&{ns4class};>$mtitle</a></td> </tr> </table> can someone please help. I'm only new to PHP and am not sure what i have done wrong. it's probably just somthing simple that i'v over looked... Quote Link to comment Share on other sites More sharing options...
Thomisback Posted March 6, 2008 Share Posted March 6, 2008 Don't use "s on the variables Quote Link to comment Share on other sites More sharing options...
mike16889 Posted March 6, 2008 Author Share Posted March 6, 2008 thanks but still not working. Quote Link to comment Share on other sites More sharing options...
Thomisback Posted March 6, 2008 Share Posted March 6, 2008 Did you try: <link href="../FP_Themes/FP_Defualt/style.css" rel="stylesheet" type="text/css" /> <table border="0" width=198> <tr> <td width="100%"><a href=$murl class="menulink" class=&{ns4class};>$mtitle</a></td> </tr> </table> ? Sorry i'm not that experienced at PHP as well, but just trying to help Edit: Oh also try to remove mysql_close(); It might solve it... Quote Link to comment Share on other sites More sharing options...
mike16889 Posted March 6, 2008 Author Share Posted March 6, 2008 that was the output but yes i see were your going with that i did try it and it dius not work... Quote Link to comment Share on other sites More sharing options...
Thomisback Posted March 6, 2008 Share Posted March 6, 2008 Look at my edited post above yours Quote Link to comment Share on other sites More sharing options...
Baabu Posted March 6, 2008 Share Posted March 6, 2008 echo ' <tr> <td width="100%"><a href="$murl" class="menulink" class=&{ns4class};>$mtitle</a></td> </tr>'; instread of this try while ($i < $num) { $mtitle=mysql_result($result,$i,"title"); $murl=mysql_result($result,$i,"url"); $mHS=mysql_result($result,$i,"HS"); ?> <tr> <td width="100%"><a href=<?php echo $mur; ?> class="menulink" class=&{ns4class};><?php echo $mtitle; ?></a></td> </tr> <?php $i++; } Quote Link to comment Share on other sites More sharing options...
mike16889 Posted March 6, 2008 Author Share Posted March 6, 2008 thanks that works but u left out an l in one of the veriables. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.