Welcome Guest, Not a member yet? Register   Sign In
CI4 - Generate sql query from query builder
#1

How to generate sql query from query builder if I have function like this?

PHP Code:
public function get_user_by_email($email)
    {
        
$this->where('email'$email);
        return 
$this->first();
    } 

Also on CI3 if I have error on my generated SQL, it will show the generated query while on CI4 it only show the mysqli_sql_exception without the SQL query. How can I show the sql query everytime I have error with query builder?
Reply
#2

PHP Code:
$error $db->error(); // Has keys 'code' and 'message'

$db->getLastQuery(); 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB