When i insert into table, how can i get the unique id of that table row without doing another query by selecting last inserted element.
lets say i do something like this:
$query = mysql_query("INSERT INTO `user_table` SET user_email='efwwe', user_pw='fwefwef'; ");
now i want to get the user_id from that last insertion. Is it possible to get this from the php $query variable? Or do i really need to do another query where i select the last row from user_table? user_id would be the unique id that is incremented automaticly in this case
regards,
alexander
you’re looking for the
mysql_insert_id()function.ex: