infinate loops
| From: | Chris Knipe | Date: | Thu, 31 Oct 2002 00:32:08 +0000 |
| Subject: | infinate loops | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-122152@lists.php.net to get a copy of this message | ||
Lo,
Quite desperate now... Or at least, I'm starting to get there... Can anyone
perhaps see why this loop is not exiting???
$quit=$now;
$glet=getdate($row['RenewDate']);
// debug
echo "howlong: " . $howlong;
while($quit<$howlong) {
// debug
echo "quit: " . $quit . "<br>";
$quit=mktime(0, 0, 0, $glet['mon']+$row['BillPeriod'],
$glet['mday'],
$glet['year']);
$retl+=$row['Cost'];
$glet=getdate($quit);
}
The values,
$now = 1036360800 (mktime())
$row['RenewDate'] = 1035928800 (MySQL DB - VARCHAR(12))
$row['Cost'] = xx.xx (MySQL DB - DOUBLE(6,2))
$howlong is defined further up....
$howlong=mktime(0, 0, 0, $_POST['month'], 1, $_POST['year'])
where...
0 < $_POST['month'] > 12
2001 < $_POST['year'] > 2005
From the debug (Browser output)...
howlong: 1133388000 - now: 1036023598 (RenewDate: 1036360800)
quit: 1036023598
quit: 1036360800
quit: 1036360800
quit: 1036360800
Thus, $quit is never incremented.... I'm *STUMPED* why not, or how to fix
this? :(( Each time, PHP times out (Script execution time exceeded), and it
*always* gives a line number for the timeout, that is inside the above while
loop. Hence, to my understanding, the loop never exits....
The loop, comes from cbms from voxel.net, stats.php
Thanks for the help!
--
me