You should do this in your SELECT clause when you get the data.
Depending on how you have your dates defined in MySQL, you can use the
built-in date stuff in MySQL, or what I often do is simply store the
date as a Unix timestamp. In any case, determine the current time, see
if the EndDate is before or after the current time, and then only show
the part you want.
Look on MySQL.com for detailed instructions on using the date fields
and date calculations.
SELECT * FROM myStuff WHERE 1 AND EndDate <= \"$current_date\"
Walter
On Jun 21, 2004, at 6:37 PM, Simon Birch wrote:
Could someone recommend a good resource, either online or a book, that
explains how to display data on a web page according to the current
date using PHP/MySQL?
Today is June 21, 2004. I want my web page to display Item 1 but not
Items 2 and 3. On June 23, my page displays Items 2 and 3 but Item 1
has "expired" and is no longer displayed.
I've really spent some time searching for than answer online,
including the PHP and MySQL manuals, but I can't find precisely what
I'm looking for. Be gentle if I'm an idiot and have overlooked
something obvious.
Many thanks.
Simon
_______________________________________________
web-development mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/web-development
Do not post admin requests to the list. They will be ignored.
_______________________________________________
web-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/web-development
Do not post admin requests to the list. They will be ignored.