Re: Problem with a time comparison loop

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

 



On Sat, 9 Oct 2004 14:51:01 +0100, Shaun <shaunthornburgh@xxxxxxxxxxx> wrote:
> I am trying to create an outlook style day view calendar. I loop through the
> hours in the day (00:00 - 23:00) and compare it to a diary table for the
> user. If the users 1st appointment isnt until 10:00 then the hours print out
> until that appointment then continue looking for the next appointment.
> 
> However if the user has no appointments in the day then the table layout
> doesnt work because of this line:
> 
> <?php if (date("H:i", strtotime(@mysql_result($qid, $i,
> Booking_Start_Date))) == $hours[$x].':'.$minutes[$y]){ ?>
> 
> With no entries for that day this results in the following:
> 
> date("H:i", strtotime(@mysql_result($qid, $i, Booking_Start_Date))) = 00:00
> $hours[$x].':'.$minutes[$y] = 00:00
> 
> My question is therefore how can i get this line ' date("H:i",
> strtotime(@mysql_result($qid, $i, Booking_Start_Date))) ' to output nothing
> if there is no entry in the database?

Wrap it with:

if(mysql_num_rows($qid)){

}


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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