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 query in that same program that INSERTED/UPDATED an auto_incremented column. If you want the maximum value of the column, you can always issue the query: SELECT max(your_auto_incremented_column_name_here) FROM your_table_name_here At 10:30 AM -0600 12/12/01, Yoed Anis wrote: >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 > -- +------------------------------------------------------------------------+ | Steve Edberg [EMAIL PROTECTED] | | University of California, Davis (530)754-9127 | | Programming/Database/SysAdmin http://pgfsun.ucdavis.edu/ | +------------------------------------------------------------------------+ | "Restriction of free thought and free speech is the most dangerous of | | all subversions. It is the one un-American act that could most easily | | defeat us." | | - Supreme Court Justice (1939-1975) William O. Douglas | +------------------------------------------------------------------------+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]