You're welcome!


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-----Original Message-----
From: Brian Drexler [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 19, 2001 1:57 AM
To: [EMAIL PROTECTED]; Php-General
Subject: Re: [PHP] Can I select only the newest record?


This worked:

SELECT * from that_table ORDER BY thetimestamp DESC LIMIT 1

Thanks to all for the help.

Brian Drexler



----- Original Message ----- 
From: Christian Reiniger <[EMAIL PROTECTED]>
To: Php-General <[EMAIL PROTECTED]>
Sent: Saturday, February 17, 2001 8:58 AM
Subject: Re: [PHP] Can I select only the newest record?


> On Saturday 17 February 2001 12:12, PHPBeginner.com wrote:
> > I wonder, if LAST_INSERT_ID will work in here...
> >
> > I know it works when on the same file was an insertion.. but will it
> > return you the last ever inserted id, say a week ago?
> 
> It will you return the id that was used on the last INSERT that *this* 
> process (i.e. this script while being executed right now) did.
> 
> => it won't help.
> 
> > > MySQL table.  I have a datetime field and an Auto_incremented field.
> 
> If you want the "newest" field, add a timestamp field and do a 
> SELECT * from that_table ORDER BY thetimestamp DESC LIMIT 1
> 
> a timestamp field in MySQL is by default automatically set to NOW() at 
> each INSERT and UPDATE if you don't set it yourself in the query.
> 
> -- 
> Christian Reiniger
> LGDC Webmaster (http://sunsite.dk/lgdc/)
> 
> Drink wet cement. Get stoned.
> 
> -- 
> 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]


-- 
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]



-- 
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]

Reply via email to