• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.