Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Where param with many to many relationship

$
0
0

Replies: 1

Hi,

First of all thanks for this amazing plugin! 🙂

I have one problem… i have table of different school classes, each with one or more teachers, and need to do list for logged single teacher.

I’m using something like this (separation to 2 variables is intentional for something else in the code)


$params_where = "where con_user.id = ".get_current_user_id();

$params = array(  
   'where' => $params_where,  
);
$classes = pods( 'class', $params);

But keep getting this error:

Database Error; SQL: SELECT DISTINCT t.* FROM wp_pods_class AS t LEFT JOIN wp_podsrel AS rel_con_user ON rel_con_user.field_id = 32 AND rel_con_user.item_id = t.id LEFT JOIN wp_users AS con_user ON con_user.ID = rel_con_user.related_item_id LEFT JOIN wp_podsrel AS rel_con_work_places ON rel_con_work_places.field_id = 117 AND rel_con_work_places.item_id = t.id LEFT JOIN wp_pods_work_places AS con_work_places ON con_work_places.id = rel_con_work_places.related_item_id WHERE ( where con_user.id = 2 ) ORDER BY con_work_places.name ASC, t.name ASC, t.name, t.id LIMIT 0, 15; Response: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘where con_user.id = 2 ) OR’ at line 22


Viewing all articles
Browse latest Browse all 59525

Trending Articles