【发布时间】:2011-06-05 23:16:12
【问题描述】:
我在 mysql 中有表:
id |数字1 |数字2|数字 3|数字3|数字5| 1 | 6 | 3 | 4 | 2 | 1 |
$num = num2; $val = 2; $id = 2;
如果我使用
$q = Doctrine_Query::create()
->update('TABLE')
->set($num, '?', $val)
->where('id = ?', $id)
->execute();
工作正常,但我使用:
$q = Doctrine_Query::create()
->from('TABLE')
->where('id = ?', $id)
->andWhere($num ,' ?', $val)
->execute();
不起作用。我有:500 内部服务器错误
Doctrine_Connection_Mysql_Exception: SQLSTATE[HY093]: Invalid parameter number: 绑定变量的数量与标记的数量不匹配
我做错了什么?
【问题讨论】:
-
$num 的值从何而来?看起来很可疑,我会谨慎处理您的操作。
标签: php sql symfony1 doctrine doctrine-1.2