使用“ IN” SQL运算符时的Kohanna模型错误

时间:2019-11-01 17:18:48

标签: php kohana-3

我正在使用kohanna 3框架,并且正在生成一个array,它的长度可能在0-1000 +行之间。为避免混淆,我将省略此数组,但这是应该在where语句中提取数据的地方。

使用kohanna模型,我有此代码

$support_tickets_model = new Model_SupportTickets();

$other_tickets_row = $support_tickets_model
                        ->where('id','IN','("2013519","2013533")')
                        ->order_by("status_id","asc")
                        ->order_by("update_date","asc")
                        ->find_all();

现在,模型仅包含$_table_name

的定义

在常规sql中,您可以执行SELECT * FROM table_name WHERE id IN (value1,value2,value3) 在kohanna中,它将返回此错误

Database_Exception [ 1064 ]: 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 ''(\"2013519\",\"2013533\")' ORDER BY `status_id` ASC, `update_date` ASC' at line 1 [ SELECT `qb_supporttickets`.* FROM `qb_support_tickets` AS `qb_supporttickets` WHERE `id` IN '(\"2013519\",\"2013533\")' ORDER BY `status_id` ASC, `update_date` ASC ]

我不知道如何解决此问题。

0 个答案:

没有答案