Re: last inserted record

From: Date: Thu, 08 Mar 2001 09:25:18 +0000
Subject: Re: last inserted record
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-43010@lists.php.net to get a copy of this message
On Thursday 08 March 2001 06:42, you wrote: > Assuming that you do have a primary key, how can you grab the last > record you inserted? Can you use @@IDENTITY, or something like that? For that I'd add another field - type "timestamp". In MySQL, timestamp fields are automatically set to NOW() on each insert and update *if* they are not set to something else in it (the insert or update) Or simply add some timestamp or datetime field that you "manually" set to NOW() on each insert (if you don't want the date to be changed on an UPDATE). > On Saturday 03 March 2001 05:16, you wrote: > > i'm having a little bit of problems with a little mysql table i'm > > using. the table has no primary key nor index nor nothing. > > > > i was wondering if it's possible to select the last inserted record > > of a table with this characteristics. > > Add a primary key. now. Accesses without that will be painfully slow. -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Very funny, Scotty! Now beam up my clothes...

« previous php.general (#43010) next »