• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DMZ 1054 problem

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
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
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
$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

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.

make a new object!

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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.