Srinivasan
Srinivasan

Reputation: 117

Call to undefined method CI_DB_mysqli_driver::and()

$q_cat_beauty = $this->db->select('*')->from('ms_categories')->where('source_id', 1)->and('category_name', 'Oral Care')->get();

i am trying to fetch the category name from my table.

Upvotes: 0

Views: 2829

Answers (2)

Reuben Gomes
Reuben Gomes

Reputation: 860

Try This

 $q_cat_beauty =
 $this->db->where('source_id', 1)
->where('category_name', 'Oral Care')
->get('ms_categories')
->result_array();

The Query builder class dosnt support and() so if you chain 2 where together like above it will represent the and you can keep chaining

https://www.codeigniter.com/userguide3/database/query_builder.html

Upvotes: 0

B. Desai
B. Desai

Reputation: 16446

There is no and keyword or method in CI. If you want where with and condition you again have to write where

$q_cat_beauty = $this->db->select('*')->from('ms_categories')
->where('source_id', 1)->where('category_name', 'Oral Care')->get();

or use array in where

$q_cat_beauty = $this->db->select('*')->from('ms_categories')
->where(array('source_id'=> 1,'category_name' => 'Oral Care'))->get();

Upvotes: 1

Related Questions