Search
 
SCRIPT & CODE EXAMPLE
 

PHP

mysqli exception handling

// we can go with die function, and some mysqli function like
// mysqli_num_rows

$con=mysqli_connect("localhost","root","","employeeDB") or die('Unable to connect');
$sql="select * from employee where id = 1";
$result=mysqli_query($con,$sql) or die(mysqli_error());
  if ($result){
  // 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";
    }
  }
Comment

PREVIOUS NEXT
Code Example
Php :: laravel relationship search 
Php :: why we use .htaccess file in php 
Php :: laravel route required parameters 
Php :: give @s potion off weekness 
Php :: php build query from array 
Php :: protected gaurded in laravel 
Php :: read xml file in php wordpress 
Php :: laravel collection times 
Php :: leftJoinSub laravel 
Php :: php string random 
Php :: php unit 
Php :: laravel intersect 
Php :: db seed in controller 
Php :: laravel validation numeric vs integer 
Php :: get pages with template wp php 
Php :: symfony messenger 
Php :: wp php get rows number from mysql 
Php :: Remove class from body tag in wordpress 
Php :: IlluminateContractsContainerBindingResolutionException 
Php :: get node url from twig 
Php :: php dom get element innerhtml 
Php :: Create Mysqli Table Using Php 
Php :: session start php 
Php :: pdo error message 
Php :: php pdo 
Php :: php string literal 
Php :: find object in array php 
Php :: php generate unique id for word 
Php :: Redirect action to certain controller method in Laravel 
Php :: join string php 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =