Jump to content
Larry Ullman's Book Forums

Recommended Posts

Hello

On page 368 MySQL second edition

when i write this script out and send it through the browser ...

 

Warning mysqli_fetch array() expects parameter 1 to be mysqli_result, boolean given /file/string/file/string

 

I have gone into the PHP web site and type in mysqli_fetch_array to look at the syntax and the page i am directed to shows, mysqli_result::fetch_array

 

and the calls in the PHP manual page for mysqli_result::fetch_array are the same as in the script in the book.

$query = SELECT etc

$r or result = mysqli_query($link, $query);

The warning in the browser is from this line of the script in the book

list($num_records) = mysqli_fetch_array($result, MYSQLI_NUM);
---------------------------------------------
if i reconstruct the call to:

list ($num_records = mysqli_fetch_array($result, MYSQLI_NUM));

the warning`s change to one warning:

syntax error, unexpected '=' expecting ',' or ')'

if i use a , the results are fatal error: cannot use function return value in write context.

and if a remove the , and close ) the list() call:
Parse error, syntax error, unexpected mysql_fetch_array expexting '='

and then its back to parameter 1 expecting to be mysql_result, boolean given.  




 

I also added the script from the PHP manual

mysqli::real_connect

and it works as a stand alone when called by the browser,

 

Does any one have any suggestions

Thank you.

Link to comment
Share on other sites

Very likely your query is invalid, thus causing that error down the line.

I would execute your query directly on the DB and make sure it's okay.

Also try echoing the query string out to the screen to make sure it's what you're expecting.

Link to comment
Share on other sites

 Share

×
×
  • Create New...