Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given 1

Status
Not open for further replies.

svar

Programmer
Aug 12, 2001
349
GR
Any idea what the issue is here:
$result_bo=mysqli_query($link, "SELECT A.field1,B.field2 FROM 'A' INNER JOIN 'B' ON A.field1=B.field2");
while($rowbo = mysqli_fetch_array($result_bo,MYSQLI_NUM)){
$bohash[$rowbo[0]]=$rowbo[1];//
}

I get mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given
 
if mysqli_query is returning a boolean it is because the query has failed.

according to the manual (the first place you should look for all php issues) mysqli_query returns boolean false on failure and a mysqi results object in other cases where a recordset is anticipated and boolean true otherwise.

your query is a SELECT so the set of returns from a mysqli_query is boolean false and a mysqli results object.

thus your query is failing. This could be because you have crafted it incorrectly or because an earlier call to the connect to the host or select a database was incorrectly actioned.

you need to use standard debugging techniques to work this through.

Code:
$result_bo=mysqli_query($link, "SELECT A.field1,B.field2 FROM 'A' INNER JOIN 'B' ON A.field1=B.field2");
if($result_bo === false):
 printf("Error: %s\n", mysqli_error());
else:
 while($rowbo = mysqli_fetch_array($result_bo,MYSQLI_NUM)):
  $bohash[$rowbo[0]]=$rowbo[1];// 
 endwhile;
endif;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top