I have a code that checks for a date and a number of days to calculate the new date. I have to dismiss weekends and holidays (which I have in a query result)
I'm comparing each day to see if it's weekend or holiday. It works fine for the first day but when it reaches the end of the array the while loop never enter again.
I tried to use reset() but it generates a warning telling me that my array is not an array or object.
what can I do to initialize the internal pointer of the array each time the while loop ends ?
Thanks for your help.
Here's my code.
for($i=0; $i<$dias;$i++)
{
$date_time = mktime(0,0,0, $month, $day, $year);
$var_days = getdate($date_time);
while( $row = mssql_fetch_array($qry_festivo) )
{
$dia_f = $row[dia];
$mes_f = $row[mes];
if($dia_f == $day)
{
if($mes_f == $month)
{
print "Festivo";
}
}
if( $var_days["wday"] == 0 )
{
$dias++;
}
elseif ( $var_days["wday"] == 6 )
{
$dias++;
}
}
$day++;
}