PHP 프로젝트에서 cron job을 사용하여 mysql 데이터베이스를 업데이트하고 싶습니다. 아래는 매년 실행하고 싶은 코드입니다. mysql에서 이벤트 스케줄러를 사용하여 시도했지만 실패했습니다.매년 데이터베이스를 업데이트합니다.
$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);
}
아무도 도와 줄 수 있습니까?
좋아, – internally1