Welcome Guest, Not a member yet? Register   Sign In
DB Query error logs not showing the script name
#1

For example I got the following error in log file.

Quote:ERROR - 2016-07-27 10:19:43 --> Query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 - Invalid query: select status as value from users where regid =

The above query is called from many controllers, so I wish to know the script name / controller / URI which produces the above error.
Is there any work around to improve the CI error logging?
Reply
#2

PHP Code:
if ( ! $this->db->simple_query('SELECT `example_field` FROM `example_table`'))
{
 
       $error $this->db->error(); // Has keys 'code' and 'message'


Get the last error.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(07-27-2016, 07:05 AM)karthik_code Wrote: For example I got the following error in log file.

Quote:ERROR - 2016-07-27 10:19:43 --> Query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 - Invalid query: select status as value from users where regid =

The above query is called from many controllers, so I wish to know the script name / controller / URI which produces the above error.
Is there any work around to improve the CI error logging?

This is what happens when you don't do abstractions. Properly structured code would enable you to easily find the error.
Reply
#4

Thanks
Reply




Theme © iAndrew 2016 - Forum software by © MyBB