Re: [PHP] Display cell if dates are between 2 dates - help

2002-11-17 Thread Ray Healy \(Data Net Services\)
Dear Jason

The startdate and endate columns are date format - have any ideas what i
can do

Thanks for yout help

Ray
- Original Message -
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, November 17, 2002 6:22 AM
Subject: Re: [PHP] Display cell if dates are between 2 dates - help


 On Sunday 17 November 2002 04:10, Ray Healy \(Data Net Services\) wrote:
  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

 What types are the columns 'startdate' and 'enddate'?

 --
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *

 /*
 You're ugly and your mother dresses you funny.
 */


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





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




Re: [PHP] Display cell if dates are between 2 dates - help

2002-11-17 Thread Jason Wong
On Sunday 17 November 2002 18:31, Ray Healy \(Data Net Services\) wrote:

 The startdate and endate columns are date format - have any ideas what i
 can do

...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...

I'm not sure what you mean by if the date in the database is a single 
number. DATE columns in MySQL are in this format '-MM-DD', so where is 
the single digit coming from? Anyway could you show a few sample entries from 
your table?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
I dote on his very absence.
-- William Shakespeare, The Merchant of Venice
*/


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




[PHP] Display cell if dates are between 2 dates - help

2002-11-16 Thread Ray Healy \(Data Net Services\)
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




Re: [PHP] Display cell if dates are between 2 dates - help

2002-11-16 Thread BigDog
This is how i deal with dates...

$date   = date in the database.
$today  = strtotime( gmdate( Y-m-d ) );
$spd= 60 * 60 * 24; // seconds per day
$fdate  = strtotime( substr( $date, 0, 10 ) );
$future = ( $fdate - $today ) / $spd;

do the comparision with $future and it should work for yeah...

Basically, I convert it all to seconds and do the math...



On Sat, 2002-11-16 at 20:10, Ray Healy (Data Net Services) wrote:
 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
-- 
.: B i g D o g :.



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




Re: [PHP] Display cell if dates are between 2 dates - help

2002-11-16 Thread Jason Wong
On Sunday 17 November 2002 04:10, Ray Healy \(Data Net Services\) wrote:
 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

What types are the columns 'startdate' and 'enddate'?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
You're ugly and your mother dresses you funny.
*/


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