codeigniter query to DB with multiple where -
I am unable to get requests for DB when passing variable in SBI query, like this is the array:
$ cl_phone = array (1,2,3); Model code below
public function get_clients_enabled_array ($ cl_phones) {$ this- & gt; Db- & gt; Order-B ('filial_id'); $ This- & gt; Db- & gt; order_by ('CLIENT_NAME'); $ This- & gt; Db- & gt; Where ('position', '1'); Forex Currency ($ cl_phones as $ value) {$ this-> Db- & gt; Where ('client_id', $ value); } $ Query = $ this- & gt; Db- & gt; Receive ('client'); Return $ query- & gt; Result_are (); Display empty array array () What is the correct way?
You must use where_in on client_id Assume that your $ cl_phones only include phone numbers, you can do something like
$ this-> Db- & gt; By order ('filial_id'); $ This- & gt; Db- & gt; order_by ('CLIENT_NAME'); $ This- & gt; Db- & gt; Where ('position', '1'); $ This- & gt; Db- & gt; Where_in ('client_id', $ cl_phones); // Change here $ query = $ this- & gt; Db- & gt; Receive ('client'); Return $ query- & gt; Result_are (); In addition, I believe you want to use where_in on the client_phone numbers and not on client_id (as long as they are identical)
Comments
Post a Comment