How to specify field name in the find() "where" parameter
-
I’m trying to use the find() function to retrieve some PODS records. I am able to use the “orderby” parameter with no problem. If my PODS field is called “staff_name” for example, I can say ‘orderby’=>’staff_name ASC’ and everything works great. But when I try to use “where” with a PODS field, say something like ‘where’=>’staff_name = Smith’, the query errors out with an SQL error saying “Unknown column ‘staff_name’ in ‘where clause'”
So I take it the orderby and where parameters use different syntax to specify the field names? I’ve read the Pods.io docs on the find() function (including the big table at the bottom) but there’s only a single where example and it searches on the WP post name field rather than a PODS field, so it isn’t much help. I tried prefixing the field name: t.staff_name and d.staff_name, etc but couldn’t find any combination that worked.
What am I doing wrong? Can anyone explain how to correctly use the “where” parameter of find() to search on a PODS field?
- The topic ‘How to specify field name in the find() "where" parameter’ is closed to new replies.