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);
hey guys,
quick question I'm having trouble finding an answer too.
In a mysql database, how can I select that last row entry. This might be
done mins after i put that entry there and i tried to use:
$lastid=mysql_insert_id(); to get the last id but to no avail.
Thanks
Yoed
--
PHP General Ma
3 matches
Mail list logo