Welcome Guest, Not a member yet? Register   Sign In
How to output SQL statement with Active Record
#1

[eluser]GeoffL[/eluser]
Sorry for the newbie question, but I only started playing with CI a week or so ago:

I have the following code that's not giving me the expected result:
Code:
function authenticate(){        
    $this->db->from('csw_user');
    $this->db->where('username', $this->db->escape($this->input->post('username')));
    $this->db->where('password', sha1($this->input->post('password')));
    $table = $this->db->get();
    if ($table->num_rows() > 0){
        $success = TRUE;
    } else {
        $success = FALSE;
    }
    return $success;
}

If I wasn't using CI, one of the first things I'd do would be to echo the SQL statement and then copy and paste it into the MySQL CLI (assuming there wasn't an obvious error). However, with Active Record, I can't find anything that gives me access to the SQL that would be passed to MySQL. Is this possible, or do I need to forget about Active Record?

TIA,

Geoff


Messages In This Thread
How to output SQL statement with Active Record - by El Forum - 07-29-2011, 04:08 PM
How to output SQL statement with Active Record - by El Forum - 07-29-2011, 06:58 PM
How to output SQL statement with Active Record - by El Forum - 07-30-2011, 12:42 AM
How to output SQL statement with Active Record - by El Forum - 07-30-2011, 01:06 AM
How to output SQL statement with Active Record - by El Forum - 07-30-2011, 02:28 AM
How to output SQL statement with Active Record - by El Forum - 08-01-2011, 01:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB