Levan Posted August 9, 2006 Share Posted August 9, 2006 I have a do-while loop that outputs a table with a series of times down one column....The concept is a day-planner.In the details section each time a row is produced it checks that the mysql query I have defined doesnt have a record with that particular time. However the system seems to go into an infinite loop and I cannot see why...code to follow...First code excerpt...the mysql query...[code]<?phpmysql_select_db($database_db_connect, $db_connect);$query_appointments = sprintf("SELECT * FROM appointment WHERE `Time` >= '%s' AND `Time` <='%s' ORDER BY `Time` ASC",$begindayunix,$enddayunix);$appointments = mysql_query($query_appointments, $db_connect) or die(mysql_error());$row_appointments = mysql_fetch_assoc($appointments);$totalRows_appointments = mysql_num_rows($appointments);?>[/code]The next excerpt is the table creation loop and inbuilt mysql check...[code] </table> <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC"><?php do{//simply gets the unix time for the current appointment slot and converts it.$currentapp_array=getdate($currentapptime);if ($currentapp_array['hours']<10){$hours="0".$currentapp_array['hours'];}else{$hours=$currentapp_array['hours'];}if ($currentapp_array['minutes']<10){$minutes="0".$currentapp_array['minutes'];}else{$minutes=$currentapp_array['minutes'];}?> <tr bordercolor="#999999" nowrap="nowrap" <?php //checks if its lunch time and greys out those slots. if ($currentapptime > $lunchbeginunixtime AND $currentapptime < $lunchendunixtime){echo 'bgcolor="#DDDDDD"';}else{echo 'bgcolor="#FFFFFF"';} ?> > <td width="10%" align="center"><a href="createappointment.php?Time=<?php echo $currentapptime;?>"><?php echo $hours.":".$minutes;?></a></td> <?php if ($currentapptime=$row_appointments['Time']){?> <td width="70%"><?php echo $row_appointments['Details'];?></td> <td width="20%"><?php echo $row_appointments['PatientID'];?></td><?php }else{ ?> <td width="70%"></td> <td width="20%"></td> <?php } ?> <?php $currentapptime=($currentapptime+$appseconds);}while($currentapptime<$endtime);?></table>[/code]I assumed that once I have processed a row from my query it moves to the next row....I think I am probably wrong in that regard...I am going to reverse the loops and see if that works any tips would be great...Lev Quote Link to comment Share on other sites More sharing options...
kalivos Posted August 9, 2006 Share Posted August 9, 2006 Can I assume that $appseconds is defined? Quote Link to comment Share on other sites More sharing options...
Levan Posted August 9, 2006 Author Share Posted August 9, 2006 Yep the table works fine if you remove the are outputting the mysql dataAppseconds is defined as 900. Quote Link to comment Share on other sites More sharing options...
kalivos Posted August 9, 2006 Share Posted August 9, 2006 That took me awhile to find :)$currentapptime=$row_appointments['Time']should be two "==" Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.