Zend Db Table delete() 无法正常工作
我有以下代码:
$time = 60 * 60 * 24 * 3;
$usersTable = new Application_Model_Db_Users();
$where = 'active = false AND registration_time < ' . time() - $time;
$usersTable->delete($where);
但是当它运行时,它会删除表中的所有行,而当我运行时,
DELETE FROM users
WHERE active = false
AND registration_time < 1290500000
只会删除符合条件的行。问题是什么?
I have the following code:
$time = 60 * 60 * 24 * 3;
$usersTable = new Application_Model_Db_Users();
$where = 'active = false AND registration_time < ' . time() - $time;
$usersTable->delete($where);
But when it is run it deletes all the rows in the table, where as when I run
DELETE FROM users
WHERE active = false
AND registration_time < 1290500000
Only the ones that match the criteria are deleted. What is the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您只需要用括号将其括起来,以便 time() - $time 正确计算。
You just need to wrap it with parenthesis, so that time() - $time evaluates properly.