...

View Full Version : My count stopped adding???



Taylor_1978
08-21-2007, 01:41 AM
Hi,

The subject line isn't a good indication of my problem, best I could come up with.

Here's my code:



$now = time();
$count = 0;
while($count < 90){
$count++;
$Dnow = date("F j, Y",$now);
$now = strtotime($Dnow);
$startdate.="<option value=\"$now\">$Dnow</option>";
$now = $now + 86400;
} // while


The odd thing is, once it gets to roughly 74 or so, or more specifically - November 4th, it stops adding to $now. It still counts, but what I end up with is all dates between now and Nov 4th, once it hits Nov 4th it continues to list Nov 4th until $count equals 90!

Now unless I am missing something really obvious, this seems extremely odd!?!?!

Any help apprecaited! :thumbsup:

Taylor.

Inigoesdr
08-21-2007, 02:04 AM
$now = time();
$count = 0;
while($count < 90){
$count++;
$Dnow = date("F j, Y",$now);
//$now = strtotime($Dnow);
$startdate.="<option value=\"$now\">$Dnow</option>";
$now = $now + 86400;
} // while

Try this ^

Taylor_1978
08-21-2007, 02:07 AM
Thanks for the reply. That does fix the problem, HOWEVER - it means I get a result I'm not after. My purpose for having the strtotime is because I want the value of midnight, not the current hour and minute - because later in the script I add to this value according to which hour in the day I want.

For example, if I want 620pm I do the value of $now + 66000... Make sense?

Perhaps there is another way of doing this instead of doing the strtotime?

Any suggestions appreciated! :thumbsup:

Taylor_1978
08-21-2007, 02:15 AM
Oh nevermind! I just realised, after I post the value I can then do strtotime to change it to the midnight value.

Thanks for the help!

Inigoesdr
08-21-2007, 02:16 AM
Use mktime(), you can generate the day/month/year from $now & date().



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum