Possible Duplicate:
PHP: Warning: sort() expects parameter 1 to be array, resource given
Please help,
I get following Error:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in......
Here is my Query:
$query = "SELECT ListNumber FROM residential";
$result1 = mysql_query($query);
if (mysql_num_rows($result1) >10){
$difference = mysql_num_rows($result1) - 10;
$myQuery = "SELECT * FROM `residential` ORDER BY `id` LIMIT 10,". $difference;
$result2 = mysql_query($myQuery);
echo $result2;
$replace = str_replace(", "," | ", $result2);
while ($line = mysql_fetch_array($result2, MYSQL_BOTH))
mysql_fetch_array()
expects parameter 1 to be resource boolean given in php error on server if you get this error : please select all privileges on your server
. u will get the answer..
$result2 is resource link not a string to echo
it or to replace some of its parts with str_replace()
.
The code you have posted doesn't include a call to mysql_fetch_array()
. However, what is most likely going wrong is that you are issuing a query that returns an error message, in which case the return value from the query function is false
, and attempting to call mysql_fetch_array()
on it doesn't work (because boolean false
is not a mysql result object).
This error comes when there is error in your query syntax check field names table name, mean check your query syntax.
Source: Stackoverflow.com