0

I have a query

SELECT post.* 
FROM wp_posts as post , 
     wp_term_relationships as term_relation, 
     wp_term_taxonomy as term_texomony, 
     wp_icl_translations as trans 
WHERE post.post_status='publish' 
AND post.post_type='post' 
AND trans.language_code = 'en' 
AND trans.element_type = 'post_post' 
AND post.ID = trans.element_id 
AND post.post_date < '2010-03-31' 
AND term_texomony.term_taxonomy_id = term_relation.term_taxonomy_id 
AND post.ID = term_relation.object_id 
GROUP BY post.ID

When I am trying to execute this query via

$data = R::getAll($sql);

or

$data = R::exec($sql);

This two lines return PHP Fatal error as

Fatal error: Call to a member function isFrozen() on a non-object in rb.php on line 9078

Is that any way to run this query or there is no way to run complex query in RedBeanPHP?

HMagdy
  • 3,029
  • 33
  • 54
  • You have a GROUP BY clause, but no aggregating functions. Perhaps you meant to use the DISTINCT operator instead? Also, do not use implicit (comma-) join syntax. It's old-fashioned, confusing, and limiting. Always use explicit JOIN syntax instead. – Strawberry May 08 '14 at 12:57
  • thanks for reply but I got the error I will post the error now – HMagdy May 08 '14 at 13:00

1 Answers1

1

This Fatal error tell us the R is non-object , after lots of debugging I found some code that unset that R so we have to redefine R via:

R::setup('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASSWORD);
HMagdy
  • 3,029
  • 33
  • 54