taluswood wrote:
> I'm trying to set a 'show if conditional' behaviour
based on the current date
> compared to the date in the database to determine if a
link should show/not
> show - I don't think I'm using the date() correctly to
find the current date -
> can anyone shed some light on this for me?
The PHP date() function is used to format a date. How you
create a
conditional statement controlled by the current date depends
on how the
date is stored in the database. Since you're using PHP, I
assume that
the date is stored in MySQL in the standard MySQL format of
YYYY-MM-DD.
If that is the case, change this:
> <?php
> // Show IF Conditional region1
> if (@$row_rs_open_mtg['date_agenda_mtg'] <= "date()")
{
> ?>
> <?php }
> // endif Conditional region1
> ?>
to this:
<?php
if (strtotime($row_rs_open_mtg['date_agenda_mtg']) <=
mktime(0,0,0)) {
// the date is earlier than today
}
?>
To compare the two values, you need to convert them to Unix
timestamps.
strtotime() does that with a MySQL date, setting the time to
midnight.
mktime(0,0,0) generates midnight at the start of the current
day.
--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of
ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/