Access Denied - why?
Posted: Sat May 17, 2008 6:33 pm
When I use this function I get the "access denied" error but if I take the same code and insert in directly into the html page from where the function was called, it works fine. The function is stored separately in a file that is loaded with required.
Can anyone throw any light on the subject. Thanks
function CreateMenu ($menuname)
{
//make the connection to the database
$connection = @mysql_connect($server, $dbusername, $dbpassword) or die(mysql_error());
$db = @mysql_select_db($db_name,$connection)or die(mysql_error());
echo "connected";
//build and issue the query and create the menu items
$sql = "SELECT * FROM $menu_table where `Menu` = '$menuname' ";
$result = @mysql_query($sql,$connection) or die(mysql_error());
while ($sql = mysql_fetch_object($result))
{
$filename = $sql -> Link;
$Text = $sql -> Title;
echo '<li>';
echo "<a href= $filename >$Text</a>";
echo '</li>';
}
}
Can anyone throw any light on the subject. Thanks
function CreateMenu ($menuname)
{
//make the connection to the database
$connection = @mysql_connect($server, $dbusername, $dbpassword) or die(mysql_error());
$db = @mysql_select_db($db_name,$connection)or die(mysql_error());
echo "connected";
//build and issue the query and create the menu items
$sql = "SELECT * FROM $menu_table where `Menu` = '$menuname' ";
$result = @mysql_query($sql,$connection) or die(mysql_error());
while ($sql = mysql_fetch_object($result))
{
$filename = $sql -> Link;
$Text = $sql -> Title;
echo '<li>';
echo "<a href= $filename >$Text</a>";
echo '</li>';
}
}