I have a loop which works, but it should only upload on mon - fri, not sat and sun!
I thought i covered this problem but obviously not. There is no update query error!.
When i display the data, if i look at the proceeding week and then the one after an so on...the data 'goes out of sync' Say certain record exist for monday, the next week they will appear on thurday, week after...tuesday!!!!
anyone know whats going on
for ($w=0;$w<=$numwks;$w++) {
if(date("D",$date)!=="Sat" && date("D",$date)!=="Sun"){
foreach( $week as $day )
{
$day_array = explode(',',$day);
$time += (60*60*24); // used to increment the days
$period = 0;
for($i=0;$i<5;$i++) {
$formatted = date('Y-m-d', $time);
$period++;
$sql = "UPDATE booking SET
classname = '" . $day_array[$i] . "',
username = '" . $day_array[$i+5] . "'
WHERE
datebooked = '" . $formatted . "'
AND roomname = '" . $roomname . "'
AND period = '" . $period . "'";
mysql_query($sql) or die ('ERROR: ' .mysql_error());
}
}
}
}
thanks😃