我有来自不同表格的分数计算。 问题是,当我插入新分数和最终分数改变时,数据库没有自动更新..
我尝试使用触发器但是我遇到了错误,因为我不知道如何实现它的正确方法..
$ firsttransgrade是最终得分..
这是我之前尝试的触发器
<?php include('../db.php'); $queryfirst = mysql_query("CREATE TRIGGER onupdate BEFORE UPDATE ON student_subject FOR EACH ROW BEGIN SET NEW.first = NEW.$firsttransgrade WHERE idnumber='$idnumber' AND subject='$subject' AND section='$section' AND level='$level' AND year='$year' AND teacher='$login_session' ; END;") or die("Query failed: ".mysql_error());?>
这是错误
Query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE idnumber='1111' AND subject='filipino' AND section='amihan' at line 4