What Is Equivalent Of Mysql_insert_id(); Using Prepared Statement?
I have used prepared statement to insert an order into an orders table but now I want to insert the order items into the order items table based on the last ID inserted in the orde
Solution 1:
If you're using PDO, it's PDO::lastInsertId(). So if your database handle is called $link:
$order_id = $link->lastInsertId();
If you're using MySQLi, it's mysqli::$insert_id or mysqli_insert_id():
$order_id = $link->insert_id;
Post a Comment for "What Is Equivalent Of Mysql_insert_id(); Using Prepared Statement?"