Welcome Guest, Not a member yet? Register   Sign In
how can i see the actual query generated by AR?
#3

[eluser]Mirage[/eluser]
Quote:How can i see what is wrong with the querys?
$log_treshold is at 4.

To see the sql statement that was executed, turn on db_debug in the database config and/or add this line after your code to see it in the log:

Code:
//Build count query
$this->db->select(‘count(timeOfBilling) as record_count’)->from($table_name);
$this->CI->flexigrid->build_query(FALSE);

$record_count = $this->db->get();
log_message('debug', var_export($this->db->last_query(), true));

$row = $record_count->row();
$return[‘record_count’] = $row->record_count;

I'm also pretty sure that you're using the select method of the AR wrong. That method is supposed to take a list of fields, not a whole query. For doing a direct query you'd use $this->db->query($sql);


Cheers,
-m


Messages In This Thread
how can i see the actual query generated by AR? - by El Forum - 10-11-2008, 02:13 PM
how can i see the actual query generated by AR? - by El Forum - 10-11-2008, 03:47 PM
how can i see the actual query generated by AR? - by El Forum - 10-12-2008, 07:37 PM



Theme © iAndrew 2016 - Forum software by © MyBB