Problem:
While working in Codeigniter framework and execution some sql query. but the sql query result is not coming as you want. In this case there are something wrong with your sql queries. Then what you will do? the answer is that you will see the what exact sql query you are executing in Codeigniter.
So how can you show or see sql query in Codeigniter?
Solution:
you can use this statement after execution sql query
you can use $this->db->last_query(); statement as below:
Example:
$sql = "SELECT district_id FROM district_names where districtname= ?";
$rsMatter=$this->db->query($sql, array($districtname));
echo $this->db->last_query();
While working in Codeigniter framework and execution some sql query. but the sql query result is not coming as you want. In this case there are something wrong with your sql queries. Then what you will do? the answer is that you will see the what exact sql query you are executing in Codeigniter.
So how can you show or see sql query in Codeigniter?
Solution:
you can use this statement after execution sql query
you can use $this->db->last_query(); statement as below:
Example:
$sql = "SELECT district_id FROM district_names where districtname= ?";
$rsMatter=$this->db->query($sql, array($districtname));
echo $this->db->last_query();
0 comments:
Post a Comment