Thanks, it worked. Another problem:
Hey folks, where is the bug in this code? When updating the date field, it is updating all the records in the table with the same value (e.g. 2008-01-07) instead of incrementing the day by one in each record.
$schedule=posit ion_courses($ti me_of_day);
$x=0;
$z=0;
$temp=0;
//getting the initial date
$date=set_date( 7,1,2008,true);
foreach($schedu le as $value)
{
$z++;
if($temp!=$valu e['day'])
{
$temp=$value['day'];
++$x;
if($x==5)
{
$x=0; //reseting the counter to 0
}
}
$day=$date['day'];
$month=$date['month'];
$year=$date['year'];
$day_name=$date['day_name'];
$full_date=$yea r.'-'.$month.'-'.$day;
if ($z!=1) $date=set_date( $date['day'],$date['month'], $date['year'],false);
// Updating the date field in the table
$sql="UPDATE roomschedule SET date='$full_dat e'";
if (!mysql_query($ sql,$con))
{
die('Error: ' . mysql_error());
}
Any help will be deeply appreciated. alexph@live.com
Hey folks, where is the bug in this code? When updating the date field, it is updating all the records in the table with the same value (e.g. 2008-01-07) instead of incrementing the day by one in each record.
$schedule=posit ion_courses($ti me_of_day);
$x=0;
$z=0;
$temp=0;
//getting the initial date
$date=set_date( 7,1,2008,true);
foreach($schedu le as $value)
{
$z++;
if($temp!=$valu e['day'])
{
$temp=$value['day'];
++$x;
if($x==5)
{
$x=0; //reseting the counter to 0
}
}
$day=$date['day'];
$month=$date['month'];
$year=$date['year'];
$day_name=$date['day_name'];
$full_date=$yea r.'-'.$month.'-'.$day;
if ($z!=1) $date=set_date( $date['day'],$date['month'], $date['year'],false);
// Updating the date field in the table
$sql="UPDATE roomschedule SET date='$full_dat e'";
if (!mysql_query($ sql,$con))
{
die('Error: ' . mysql_error());
}
Any help will be deeply appreciated. alexph@live.com
Comment