PHP MySQL Last Inserted ID

PHP MySQL Last Inserted ID

PHP MySQL Last Inserted ID

 

In This Article , i will show you how to get the below data

(1) Last Inserted Auto Incremented row Ids

(2) Number of Affected rows by the Executed querries

 


// MySqL Querries
		  
		  $email_SQL ='INSERT INTO emailstore (email)VALUES('.'"'.$enterEmail.'"'.')';
		  
		     // If data Base Connection is Ok execute the Querries above
		  
		  if ($dbConnectionStatus->query($email_SQL))  {	
		  
		      echo 'Email Inserted'.'<br>';
			  
			  // Echo Affected Rows
			  // $dbConnectionStatus is an Instance Declare using the new mysqli() function
			  echo "Affected Rows :". $dbConnectionStatus -> affected_rows."<br>";
			  //  check the newly Incremented Ids and print it
			  
			  echo " Incremented New User Ids : ". $dbConnectionStatus -> insert_id."<br>";
			  
			 
			  
			  
	 
		  
		  }




 

Leave a Reply

Your email address will not be published. Required fields are marked *

sixteen − six =