Skip to content Skip to sidebar Skip to footer

Typical Php Errors

I ve got 2 problems . mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given and mysqli_query() expects parameter 1 to be mysqli, string given I tried every

Solution 1:

I'm not an expert, but I think you are "mysqli_query" in the wrong way.

$result=mysqli_query($sql,$con);

It should be

$result=mysqli_query($con,$sql);

The first parameter is expected to be the connection query

Also

$rows=mysqli_fetch_array($result,$con) 

should be

$rows=mysqli_fetch_array($result) 

or

$rows=mysqli_fetch_array($result, MYSQLI_ASSOC)

Solution 2:

Otherwise using mysqli as an object:

...
$con = new mysqli("localhost","root","","kluby ranking");
...

// select record from mysql $sql="SELECT * FROM europa";
$result=$con->query($sql);
...

while($rows=$result->fetch_array()){    
...

Post a Comment for "Typical Php Errors"