how MySQL Query in Error Log in CodeIgniter

asked Jun 2, 2015 in codeinither by rajesh
0 votes

1 Answer

0 votes
I just took a quick peek inside the system/database/DB_Driver.php (line 323) file and it doesn't log the SQL query with any settings you choose. It should however print these messages to the screen if you are in db_debug mode.

If you don't mind messing with the files in the CI system folder, you could get the sql statement in your log file by changing system/database/DB_Driver.php (line 323, for CI 2.0.1) to:

log_message('error', 'Query error: '.$error_msg. ' - '. $sql);
answered Jun 2, 2015 by rajesh