where_in condition in Codeigniter
The where_in method allows you to specify multiple values in a WHERE clause. Generates a WHERE field IN (‘item’, ‘item’) SQL query joined with AND if appropriate
Let’s create a where_in method in codeigniter
$id = array('1', '15', '20');
$this->db->where_in('id', $id);
// Produces: WHERE id IN ('1', '15', '20')
Leave a Reply