I have a mysql database with a 2 column table. date from and date to
I am trying to pull the information in an array
[php]
$strDateFrom = $row_test[‘datefrom’]; // date(‘Y-m-d’, mktime(0 ,0 , 0, $monthFrom, $dayFrom, $yearFrom));
$strDateTo = $row_test[‘dateto’]; // date(‘Y-m-d’, mktime(0 , 0, 0, $monthTo, $dayTo, $yearTo));
function createDateRangeArray($strDateFrom,$strDateTo) {
// takes two dates formatted as YYYY-MM-DD and creates an
// inclusive array of the dates between the from and to dates.
// could test validity of dates here but I’m already doing
// that in the main script
$aryRange=array();
$iDateFrom=mktime(1,0,0,substr($strDateFrom,5,2), substr($strDateFrom,8,2),substr($strDateFrom,0,4));
$iDateTo=mktime(1,0,0,substr($strDateTo,5,2), substr($strDateTo,8,2),substr($strDateTo,0,4));
if ($iDateTo>=$iDateFrom) {
array_push($aryRange,date(‘Y-m-d’,$iDateFrom)); // first entry
while ($iDateFrom<$iDateTo) {
$iDateFrom+=86400; // add 24 hours
array_push($aryRange,date('Y-m-d',$iDateFrom));
}
}
return $aryRange;
}
[/php]
It is working, sort of. Its only pulling the first line and turning it into an array.
I have tried a repeat region but nothing, its still only showing the first line
[php]
do {
$aryDates=createDateRangeArray($strDateFrom,$strDateTo);
$dates=$aryDates;
} while ($row_test = mysql_fetch_assoc($test));
[/php]
Can anybody help