Re: Problem with a time comparison loop

From: Date: Sat, 09 Oct 2004 13:55:45 +0000
Subject: Re: Problem with a time comparison loop
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-199070@lists.php.net to get a copy of this message
On Sat, 9 Oct 2004 14:51:01 +0100, Shaun <shaunthornburgh@hotmail.com> 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/

« previous php.general (#199070) next »