[PHP] last entry in mysql

2001-12-12 Thread Yoed Anis
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

Re: [PHP] last entry in mysql

2001-12-12 Thread Jon Niola
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);

Re: [PHP] last entry in mysql

2001-12-12 Thread Steve Edberg
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