Page 1 of 1

Looping help

Posted: Wed Feb 28, 2007 11:19 am
by fitchic77
I need to do something like:

For y = iBeginDay to iEndDay

Next

How would I do this in .php?

Many thanks!

Posted: Wed Feb 28, 2007 11:23 am
by feyd

Code: Select all

for ($y = $iBeginDay; $y <= $iEndDay; $y++)
{
  ;
}
or similar.

Posted: Wed Feb 28, 2007 11:31 am
by fitchic77
Thanks. That has been what I have been doing.

When I plug in dates...my loop gets locked up..Both dates are stored as a DATE in mysql.

Code: Select all

forr ($y = $myrow['sdate']; $y <= $myrow['edate']; $y++) 
{ 
 echo "here" .$y; 
}
Any thoughts?[/url]

Posted: Wed Feb 28, 2007 11:43 am
by feyd
ignoring "forr," iteration over date values is more easily accomplished via strtotime().

Why do you wish to iterate the dates?

Posted: Wed Feb 28, 2007 12:02 pm
by fitchic77
I'm building a calendar. I need to highlight anything between start date and end date that are spanned days for the stored events.

thanks.