assuming you are using a date format field, you can do something like (not
tested, please check syntax!)

$SQL = "SELECT text FROM events WHERE date < " . date("Y-m-d") . " SORT BY
date DESC LIMIT 1";

good luck

Beau

// -----Original Message-----
// From: Andrew [mailto:[EMAIL PROTECTED]]
// Sent: Sunday, 12 May 2002 3:44 PM
// To: [EMAIL PROTECTED]
// Subject: [PHP-DB] Upcoming event script
// 
// 
// I'm sorta new at php, as most of my experience is in 
// ASP...so I need a
// little help.
// 
// I am making a "next upcoming event" script. Basically, I 
// want to be able to
// put into mysql a description of the even and a date where 
// the posting should
// start, and I want to be able to make it show the most 
// recently passed post
// date. So in other words, if today is June 1 2002, and I have 
// 3 records with
// post dates of May 28, March 22, and June 13 of that year, I 
// want it to show
// the May one. How do I sort this? I know that in ASP it would 
// be "SELECT text
// FROM events WHERE date < " & now() & "SORT BY date DESC", 
// but how do I do it
// in php?
// 
// 
// 
// 
// -- 
// PHP Database Mailing List (http://www.php.net/)
// To unsubscribe, visit: http://www.php.net/unsub.php
// 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to