Display cell if dates are between 2 dates - help
| From: | Ray Healy \(Data Net Services\) | Date: | Sat, 16 Nov 2002 20:10:35 +0000 |
| Subject: | Display cell if dates are between 2 dates - help | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-124746@lists.php.net to get a copy of this message | ||
Dear all
I'm trying to create a search function that can check the current day in a calendar against a
mysql database where there is a startdate and enddate and if the date is there then colour code the
cell in the calendar.
I have tried to use the following command
$eventQuery = "SELECT title FROM prestigecal WHERE '$sql_currentday' BETWEEN
startdate AND enddate;";
The database has an ID - title - startdate - enddate
This seems to work BUT if the date in the database is a single number i.e. 0 to 9 it cannot dispaly
it and also if the startdate or endate is a 10, 20 or 30 it also thinks that it is a 1, 2or 3
Just in case it helps the full codede for this section is as follows :
/snip
$sql_currentday = "$year-$month-$zz";
$eventQuery = "SELECT title FROM prestigecal WHERE '$sql_currentday' BETWEEN
startdate AND enddate;";
$eventExec = mysql_query($eventQuery);
while($row = mysql_fetch_array($eventExec)) {
if (strlen($row["title"]) > 0) {
echo "<td bgcolor=\"red\" valign=\"middle\"
align=\"center\"><font size=\"1px\"
face=\"Verdana\">$zz</font></td>\n";
$result_found = 1;
/snip
Thanks for any advice.
Ray