[RESOLVED] Unknown column 'date' in 'order clause' |
[eluser]Christopher Clarke[/eluser]
Hello, Although I'm not asking for this column at all in my script, and it doesn't exist in my database, I keep getting the following error, seemingly at random, which makes my script fail to run. Unknown column 'date' in 'order clause' I'm not specifying $this->db->where('date') or similer in the queries which are doing this. I know adding the date column to the tables in question will fix this, but I'd rather not. This is the method which in which the error is currently occuring: http://pastebin.com/m5377772e It does not occur in all contexts, this function works in other locations. The context is: http://pastebin.com/m3a73cd3d What could be the issue? Thanks in advance. ~ Chris
[eluser]Clooner[/eluser]
Without going through all your code at pastebin.... What are the sql queries generated by ActiveRecords? (you can view them using the profiler)
[eluser]Christopher Clarke[/eluser]
Since the page generated is a generic CI error document, the profiler doesn't work. The full output of the error is as follows: Code: A Database Error Occurred And the following output (from Profiler) is of a typical page... which also happens to make use of the query (and runs fine) that is causing the error on the page which is ouputing the error: Code: 0.0006 SELECT * (Hmm, I see some opportunities for optimisation) If I add the date field, the code works fine but as I said, I'm not referring to date to begin with.
[eluser]Christopher Clarke[/eluser]
Actually, this may be more useful - its the page causing the error if I cave in and add date to my table. Code: 0.0006 SELECT *
[eluser]Christopher Clarke[/eluser]
I worked it out. I thought the get novel query was referring to the get_novel method but it was actually referring to novel_exists(); which did indeed contain order_by(date). I'm not sure why that was, but its working now. Thanks clooner for introducing me to the profiller. I had no idea that existed, but I can see how useful it is going to be. ~ Chris RESOLVED |
Welcome Guest, Not a member yet? Register Sign In |