Page 1 of 1

Making a "repeat region" for a specific variable

Posted: Tue May 10, 2005 12:28 am
by wkrauss
What I am trying to accomplish is format a date from a database then have a specific array repeated for all records in the database. I have figured everything out except the repeating part.

Here's the basic code I started with:

Code: Select all

$days = array(
					$today=>array(NULL,'calendar-day',NULL,NULL.$today.'</span>'),
      			  9=>array('#','calendar-linked',NULL,NULL.'9'.'</span>'),
      			  10=>array('#','calendar-linked',NULL,NULL.'10'.'</span>'),
      			  11=>array('#','calendar-linked',NULL,NULL.'11'.'</span>'),
					);
Then I added the date formatting, recordset, and connection to database:

Code: Select all

$evtDate = $row_rsAppearances['Date'];
			list ($evtYear, $evtMonth, $evtDay) = explode ("-", $evtDate);
									
					$days = array(
					$today=>array(NULL,'calendar-day',NULL,NULL.$today.'</span>'),
      			  $evtDay=>array('#','calendar-linked',NULL,NULL.$evtDay.'</span>'),
					);
So now, rather than using "9" "10" and "11" it will use the values from the database ($evtDay). Only problem is I cant get it to repeat. It will only write the code of line 6 (in the 2nd php code box) one time rather than once for every date entry in the database. Any help would be much appreciated.

Posted: Tue May 10, 2005 3:54 am
by s.dot
try

Code: Select all

while($evtDate = $row_rsAppearances['Date']){

list ($evtYear, $evtMonth, $evtDay) = explode("-",$evtDate);
   $days = array(
   $today=>array(NULL,'calendar-day',NULL,NULL.$today.'</span>'),
   $evtDay=>array('#','calendar-linked',NULL,NULL.$evtDay.'</span>'));
}