i have to run 2 queries for inserting 2 different tables

userorder table contains orderid , title

order_details containts orderid, qty

so how can i get orderid for my order_details? the code below donts seems able to get last orderid

$query = mysql_query("SELECT last_insert_id()");

list($oid)=mysql_fetch_row($query);

You can use mysql_insert_id() function after your insert query.

You can use mysql_insert_id() function after your insert query.

i got this error, is it the right way to use insert_id() ?

Fatal error: Call to undefined method MySQL::insert_id() in D:\xampp\htdocs\book\checkout-process.php on line 40

$oid = $db->insert_id();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.