我想在php項目中使用cron job更新mysql數據庫。下面是我想要每年運行的一段代碼。我曾嘗試在MySQL中使用事件調度程序,但我失敗了。每年使用cron作業更新數據庫
$stud="select * from student_class where class<4";
while ($row=mysql_fetch_array($stud))
{
$sql = "INSERT into student class(id,student_id,class,year) values('','{$row
['student_id']}','{$row['class']}','{$row['year']}+1')" ;
mysql_query($sql);
}
任何人都可以幫忙嗎?
好的,我試試dat – internally1