【发布时间】:2012-03-13 05:08:34
【问题描述】:
我在 php $newtotal 中有一个动态变量。当这个变量大于我的 MAX 数据库整数时,我想INSERT
$newtotal = 4000;
mysql_query("INSERT INTO mytable (`DATE`, `TOTAL`, `DBTOTAL`) VALUES ('2012-03-09', '1', '$newtotal') WHERE MAX(`DBTOTAL`) < '$newtotal'");
即。在我的数据库中,我的 MAX(DBTOTAL) = 4050;
这不应该INSERT;当$newtotal 更改为大于4050 时,它也应该正确INSERT,但是我在任一变量号上都出现语法错误。在此处需要语法方面的帮助。
【问题讨论】: