Forums

PHP

This topic is locked

Show/Hide Based on Date

Posted 17 Jul 2002 00:35:22
1
has voted
17 Jul 2002 00:35:22 Peter R posted:
Hi,

I'm trying to use the following IF statement to show or hide a table depending on today's date, and a future date stored in a database.
(Ignore the "Y", this is an IF statement I took from one of my pages... it's not an attempt at the current problem)

<?php if ($rsestatedetails->Fields("estate_date" == ("Y") { ?>
<TABLE></TABLE>
<?php }
/* if ($rsestatedetails->Fields("estate_date" == ("Y") */
?>

(I can't get this thing to display my code correctly so here's a link to it incase:
www.shopstrathroy.com/ifthen.htm )

I have a date in a field(estate_date) in my database. What I would like is, when the date in estate_date is 30 or LESS days away from today's date, show the table. Now keep showing the table until the date in estate_date is behind today's date.(For a total of 30 days) Then hide the table again.

i.e. The date in the database = 2002-08-27
Today's Date = 2002-07-16 - Hide Table
Today's Date = 2002-07-29 - Show Table
Today's Date = 2002-08-18 - Show Table
Today's Date = 2002-08-28 - Hide Table

Can the above IF statement be modified to achieve this?

Thank you!

Peter

Reply to this topic