Welcome Guest, Not a member yet? Register   Sign In
Where to look for an SQL string?
#1

[eluser]Bikun[/eluser]
How could I get to know in which file and line is error occurred?

Error is as follows, but it's REALLY difficult to figure out the exact file where I should make changes:
Code:
A Database Error Occurred

Error Number: 1054

Unknown column 'is_author' in 'where clause'

SELECT FORMAT(AVG(price), 0) AS average_price FROM (users) WHERE `is_client` = 1
#2

[eluser]Colin Williams[/eluser]
It should be happening in the model.
#3

[eluser]Bikun[/eluser]
I don't use models ... It's happening in controller. It's not a big issue to find where, but it would be much easier if I could see the exact file and line near that error. Is it possible to configure it somehow in an east way?
#4

[eluser]Colin Williams[/eluser]
Well, it's MySQL generating the error, not PHP. So there's no way it could know the line number, file, etc.
#5

[eluser]TheFuzzy0ne[/eluser]
Run a file search for the word "FORMAT" (case-sensitive) within the file contents.

On a Linux server, cd into your application directory, and fire this command:

grep -r "FORMAT" ./
#6

[eluser]kevinprince[/eluser]
Are you using active record or even if your

do echo $this->db->last_query();

paste what you get in here along with the php code your using to generate the query.




Theme © iAndrew 2016 - Forum software by © MyBB