Looping help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fitchic77
Forum Commoner
Posts: 51
Joined: Thu Jul 20, 2006 11:57 pm

Looping help

Post by fitchic77 »

I need to do something like:

For y = iBeginDay to iEndDay

Next

How would I do this in .php?

Many thanks!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

for ($y = $iBeginDay; $y <= $iEndDay; $y++)
{
  ;
}
or similar.
fitchic77
Forum Commoner
Posts: 51
Joined: Thu Jul 20, 2006 11:57 pm

Post 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]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

ignoring "forr," iteration over date values is more easily accomplished via strtotime().

Why do you wish to iterate the dates?
fitchic77
Forum Commoner
Posts: 51
Joined: Thu Jul 20, 2006 11:57 pm

Post 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.
Post Reply