Click here to Skip to main content
15,392,078 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have this imported database in phpmyadmin with two tables and I am using codeanywhere. The tables are simple: First table i20_vrste(id, naziv), Second table i20_zivotinje(id, id_vrste, ime, starost, bolesna)

So, the connection file contains:


  $conn=mysqli_connect($servername, $username, $password);

and then my second file with included connection, sql query looks like this:

$sql="select * from i20_vrste,i20_zivotinje where";
              if($bolesna==1){$bolesna="da";} else {$bolesna="ne";}
            echo "$id$naziv$ime$starost$bolesna";

When I run it, I want to see the data from imported database but it pops this error mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in.

Why is this happening and what can I do to resolve this error ?

What I have tried:

I know that problem is in sql query probably, but please notice that I am a total beginner in php and I could use some help.
Updated 16-Feb-19 1:28am

1 solution

Look at the MySQL documentation for the previous method call[^] where it explains what return value you will receive if the request fails.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900