I am getting this error on my index.php page where i have also included the code
<?pho
require 'connect.php';
?>
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given
<?php
$sql = "SELECT * FROM 'menulinks'";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)) {
echo '<li>', $row['linktitle'], '<li>';
}
?>
Here is my connect function
<?php
$con = mysql_connect('localhost', 'root', '') or die('Sorry, we could not connect');
mysql_select_db('philipsnewsite', $con) or die('Sorry, we could not connect');
?>
You have quoted your table name in single-quote characters, which MySQL interprets as a string literal. You should either use backticks, or no quote characters at all:
This syntax error caused the
mysql_query()function to return false, which you can test as follows:Also note, as documented in a big red box at the top of the manual page for
mysql_query():