Welcome Guest, Not a member yet? Register   Sign In
DMZ 1054 problem
#1

[eluser]rootman[/eluser]
Hi, I got a 1054 Error on a query generated by DMZ.

I looked up the error in the troubleshooting section of DMZ and it says to update the mysql_driver ... i've done that but still error ...

Here the generated query
Code:
SELECT `news`.* FROM (`news`) LEFT OUTER JOIN `categories_news` as categories_news ON `news`.`id` = `categories_news`.`news_id` LEFT OUTER JOIN `categories` as categories ON `categories`.`id` = `categories_news`.`category_id` WHERE `categories`.`id` = '2'

Here the error
Code:
A Database Error Occurred

Error Number: 1054

Unknown column 'categories.id' in 'where clause'

SELECT `news`.* FROM (`news`) WHERE `categories`.`id` = '2' ORDER BY `news`.`publish_date` desc LIMIT 12

And the call
Code:
$n->where_related('category','id', $this->session->userdata('news_searchcategory'));

And later i call the get with some more settings.
I cant find an error, maybe i am just missing something, any help would be much appreciated.

cheers! Big Grin
#2

[eluser]rootman[/eluser]
Okay, found the solution myself:

I called 2 functions on $n, first one was a count(), second one a get() with offset. So i had to add the where_related part twice in my script cause count() clears out the query. The problem is, the second time you apply where_related() it misses the join parts and so there is no table category and no field id.

SOLUTION:
make a new object!

or clear out the old one, i dont know if there is a reset function, but i think there is.




Theme © iAndrew 2016 - Forum software by © MyBB