This may be stating the obvious, but:
(1) Does your table have an auto_increment column?
(2) If so, did a previous query in the program - for example, an
INSERT - generate a new record with an auto_incremented value? AFAIK,
mysql_insert_id() won't return the last id unless you have a previous
You should try using mysql_insert_id() with the connection descriptor.
For example:
$dblink = mysql_connect($host, $user, $password);
mysql_select_db($databasename, $dblink);
The $dblink variable or what I call the connection descriptor, should be
used with mysql_insert_id($dblink);
2 matches
Mail list logo