Click here to Skip to main content
15,893,190 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys.. sorry for my bad english but i m russian.. i get this error Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in..
I put line 231 where is this error..

Factiuni <?= mysqli_num_rows(mysqli_query($DB_H, "SELECT * FROM factionlist ")); ?>

What I have tried:

Nothing.. i don t know what i can do..
Posted
Updated 26-Jul-17 1:53am
Comments
Afzaal Ahmad Zeeshan 26-Jul-17 8:15am    
I believe, there is a problem with your parameters.

1 solution

mysqli_query has mixed return types. So you have to split your command into two independant ones to create a mysqli_result variable:
PHP
<?php
if ($result = mysqli_query($DB_H, "SELECT * FROM factionlist")) {
    $row_cnt = mysqli_num_rows($result);
    mysqli_free_result($result);
}
?>

See also PHP: mysqli::query - Manual[^] and PHP: mysqli_result::$num_rows - Manual[^] (also available in Russian).
 
Share this answer
 
Comments
Jochen Arndt 26-Jul-17 8:04am    
I can't see a difference between the above two lines and the initial posted one.

Anyway, you have to pass a mysqli_result value to mysqli_num_rows(). That can be achieved with my solution.

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