menu display function only displays on entry page
Posted: Mon Mar 10, 2003 4:15 am
Here is the code for a function i have made to display a menu which is being written from the database.
this works fine on any pages that are being accessed directly, but when I come from another page to it, then it does not display. I take it the problem must be in the $result – which is
wouldn’t have thought it would be this as this value will be consistent, wont it.
Thank you in advance for any help to point me in right direction
Code: Select all
function writeMainMenu()
{
global $result;
$num_rows = mysql_num_rows($result);
if ($num_rows > 0) {
echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
while ($row = mysql_fetch_assoc($result)) {
echo '<tr> <td height="25" >';
echo '<a href="'.$rowї'link'].'"><img src="'.$rowї'image'].'" width="136" height="25" alt="'.$rowї'alt'].'" border="0" /></a>'."\n";
echo '</td></tr>';
}
echo '</table>';
}
}Code: Select all
$result = mysql_query("SELECT * FROM mainMenu",$db);Thank you in advance for any help to point me in right direction