php - Can't get result from $this->db->last_query(); codeigniter -


quite simple thing ask , must discussed many times, still not able result of $this->db->last_query();.

            $this->db->select('count(*) totalverified,res_sales.upduser, employee.name');         $this->db->from('res_sales');         $this->db->join('employee','employee.user_id = res_sales.upduser');         $this->db->where('date>=', $fromdate);         $this->db->where('date<=', $todate);         $this->db->where('verificationnumber<>', '');         $this->db->where('verificationnumber<>', null);         $this->db->group_by('res_sales.upduser');         $this->db->group_by('employee.name');         $q = $this->db->get();         $str = $this->db->last_query();         print_r($str);         if ($q->num_rows() > 0)         {             return $q->row();         }          return false; 

above code in model function. not able result expected want see query being run @ backend.

thanks. danish

i figured out problem. have write statement above query i.e:

$this->db->save_queries = true; 

after write query , write $this->db->last_query(); showing last query now.

sample:

$this->db->save_queries = true; $str = $this->db->last_query(); echo $str; 

cheers.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -