How to do MySQL IN clauses using Zend DB?

半城伤御伤魂 提交于 2019-12-04 03:52:42

Don't implode the array, just pass it:

->where('product_ref_id IN (?)', $product_ids);

It is worth mentioned that there is 2 ways to use WHERE IN clausule in Zend_Db_Select:

  1. We can pass array as second parameter:

    $select->where("column_value IN (?)", $array_of_values)

  2. Or we can simply implode array to get values as string:

    $select->where("column_value IN (" . implode(',', $array_of_values) . ")")

->where('country_id IN (?)', $country_ids);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!