PHP & MySQL: MySQLi_Num_Rows() Expects Parameter 1 to Be MySQLi_Result, Boolean Given

PHP & MySQL: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given

$dbc is returning false. Your query has an error in it:

SELECT users.*, profile.* --You do not join with profile anywhere.
FROM users
INNER JOIN contact_info
ON contact_info.user_id = users.user_id
WHERE users.user_id=3");

The fix for this in general has been described by Raveren.

mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean with mysqli

According to another question here :

The INSERT command will return a boolean(true/false), So you must use select command to get the required result

SQL PHP Error: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given

This is because $conn->query($sql); returned FALSE. Your call $conn->query($sql); was not successful.

You have an error in your syntax:

$sql = "SELECT * FROM tbl_flights WHERE pilot_initial_post IS NULL OR = '' AND is_deleted = '0'"; 

should be changed to

$sql = "SELECT * FROM tbl_flights WHERE (pilot_initial_post IS NULL OR pilot_initial_post = '') AND is_deleted = '0'"; 

The OR operator requires the field_name.

And for debugging add or die(mysqli_error($conn)); to your $conn->query($sql); call.

PHP :Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, string given

Just change this code

$query= "SELECT * FROM residential ";

Into

$query= "SELECT * FROM residential WHERE 1"; 

And change this code

<?php if(mysqli_num_rows($query)>0):?>
<?php while($row= mysqli_fetch_assoc($query)):
print_r($row);
die;
?>

To

<?php 
$res = mysqli_query($con, $query); //replace $con with your db connection variable
if(mysqli_num_rows($res)>0):?>
<?php while($row= mysqli_fetch_assoc($res)):
print_r($row);
die;
?>

What does it want? - mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given

You have a comma before FROM in your select statement.



Related Topics



Leave a reply



Submit