php - Easy way of getting unique id -


when insert table, how can unique id of table row without doing query selecting last inserted element.

lets this:

$query = mysql_query("insert `user_table` set user_email='efwwe', user_pw='fwefwef'; "); 

now want user_id last insertion. possible php $query variable? or need query select last row user_table? user_id unique id incremented automaticly in case

regards, alexander

you're looking mysql_insert_id() function.

ex:

mysql_query("insert mytable (product) values ('kossu')"); printf("last inserted record has id %d\n", mysql_insert_id()); 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -