简体   繁体   中英

php insert mysql_query get id

In PHP 4, how can I easily get the last id after an insert in db? For example:

$queryInsert = "INSERT INTO `table` (`id`, `info`) VALUES (NULL, '".$INFO_VAR."');";

mysql_query($queryInsert) or die (mysql_error());

use mysql_insert_id(); , you find the doc here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM