Re: calendar Q

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok. Thanks.

One more question. I have dates as a datetime in DB. Like 2006-08-11 
08:20:00 and I'm playing only with date part in the calendar 2006-08-11. So 
how to compare this date to the datetime info in DB? Do I need to use 
DATE_FORMAT or someting like this in the query?

Thanks
-Will



""Richard Lynch"" <ceo@xxxxxxxxx> kirjoitti 
viestissä:2821.67.108.68.40.1155241480.squirrel@xxxxxxxxxxxxxxxx
> On Thu, August 10, 2006 12:14 pm, William Stokes wrote:
>> I have a calendar script that displays a simple mini calendar view one
>> month
>> at a time. User can click any date and the calendar opens another page
>> that
>> displays that date's events. I would like to highlight to the mini
>> calendar
>> view dates that have an event in database. So what would be a simple
>> way to
>> check for events while the selected months days are printed to screen?
>
> Depending on the number of records, the PHP<->MySQL connection speed,
> and the indexes or lack thereof on your date column...
>
> 1. You could do a query for each date like:
> select count(*) from events where whatdate = '$date'
>
> 2. You could pre-fill an array with dates that have an event:
> select whatdate from events
> where whatdate >= '$month/1/$year'
> and whatdate < '{$month+1}/1/$year' /*might need something better here*/
> group by whatdate
> order by whatdate
> while (list($whatdate) = mysql_fetch_row($result)){
>  $event_date[$whatdate] = true;
> }
> Then, while filling out the calendar, just check:
> if (isset($event_date[$date])){
>  //color it as having events
> }
>
> -- 
> Like Music?
> http://l-i-e.com/artists.htm 

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux