i want to fetch that from mysql database using codeigniter framework php? -


i want fetch through model

select `id`, `name`, `visits`, `shortdes`, `photo` `products`           `name` '$word'          or `shortdes` '$word' ,  `valid` = 1 order `id` desc 

i used that, returned false

$this->db->order_by('id', 'desc'); $this->db->like('name', $word); $this->db->or_like('shortdes', $word); $this->db->where('valid', 1); $this->db->select('id, name, visits, shortdes, photo'); $query = $this->db->get('products'); 

what can use?

for debugging codeigniter's query builder query's, reccommend doing debug them , see query statements producing.

$this->db->order_by('id', 'desc'); $this->db->like('name', $word); $this->db->or_like('shortdes', $word); $this->db->where('valid', 1); $this->db->select('id, name, visits, shortdes, photo'); $query = $this->db->get('products');  echo "<pre>" die(print_r($this->db->last_query(), true)); 

when ran, output actual raw sql query being produced, , can debug there.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -