Search
 
SCRIPT & CODE EXAMPLE
 

PHP

warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, bool given in

// warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, bool given in,
//this error will get mostly when query not giving any return value or having some error in query
$con=mysqli_connect("localhost","root","","employeeDB");
$sql="select * from employee where id = 1";

  if ($result=mysqli_query($con,$sql)){
  // this will return the number of rows in result set
  	$numRos=mysqli_num_rows($result);
    if($numRos > 0){
    	$data = mysqli_fetch_array($result);
    	print_r($data);
    }else{
    	print "No data found";
    }
  }

mysqli_close($con);
Comment

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

// set a veariable to get your query like
$query = mysqli_query($connection-name,$sql-statment-name);

//then use an if statement to get the rows something like this
	if($query){
    	$result = mysqli_num_rows($query);     
      if($result > 0){
 // write a code for what you want to happen if the data exists in the databse
      }else{
 // write a code for what you want to happen if the data dosen't exist
     //in the databse  
      }
   }
   else{
   return "query failed";
   }
 //and thats all 
Comment

mysqli_num_rows() expects parameter 1 to be mysqli_result, bool given

$query = mysqli_query($connection-name,$sql-statment-name);

//then use an if statement to get the rows something like this
	if($query){
    	$result = mysqli_num_rows($query);     
      if($result > 0){
 // write a code for what you want to happen if the data exists in the databse
      }else{
 // write a code for what you want to happen if the data dosen't exist
     //in the databse  
      }
   }
   else{
   return "query failed";
   }
 //and thats all 
Comment

PREVIOUS NEXT
Code Example
Php :: debug bar laravel print array 
Php :: send data with href 
Php :: Laravel Retrieving & Deleting An Item from session 
Php :: php sec to hours/minuts 
Php :: php artisan make:widget 
Php :: heroku deploy php 
Php :: how to fetch days old records php mysql 
Php :: string to array php 
Php :: + php quantifer 
Php :: check date is in the last 24 hours? 
Php :: change native password in phpmyadmin 
Php :: php set time counters inside code meassure 
Php :: check email veriy or not laravel 
Php :: Gate::before not working laravel 8 
Php :: 0 
Php :: bulk write mongodb php 
Php :: Token capabilities in vault 
Php :: csv file import to mysqli using php 
Php :: update php local 
Php :: lookup token information in vault 
Php :: laravel route model binding 
Php :: laravel search function 
Php :: return response at failedValidation() in request laravel 
Php :: php last of string till / 
Php :: onclick on image php 
Php :: connect an if statement to an input php 
Php :: php access class variable 
Php :: avatar generator laravel 
Php :: guzzle login example 
Php :: form submit self php isset 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =