> I am looking for some automatation using MYSQL and PHP: All entries in a
> table have a date-field, so that our user are automatically informed
> about the last update of the corresponding entry, but not about the
> site's generall update. The idea is to look into the date-fields, select
> the latest entry and printing it into HTML (we make our updates only
> using the database, so one of our entries, but not always the last one,
> has the correct date). So we have the table:
>
> entry 1 / 2000-11-29
> entry 2 / 2001-09-02
> entry 3 / 2001-11-04
> entry 4 / 2001-11-03
>
> Obviously the second date's enrtry should be selected, but I have no
> idea how to do it...

If you only need that 3rd entry (ie the latest date's record) a simple

SELECT columns FROM table ORDER BY date DESC LIMIT 1;

will provide you with the record with the latest date (of course you can add
a where clause to tell MySQL which records should be even considered for
selection)

Sincerely,

Craig Vincent



-- 
PHP Database 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