Code for if statement

12 posts by 4 authors in: Forums > CMS Builder
Last Post: September 25, 2013   (RSS)

By Jason - September 24, 2013

Hi,

In getRecords(), if you set more the 'where' option more than once, only the second value will be used (as it overwrites the first one in the array). So, if you need to filter your record list by more than 1 field, you need to combine your statements into a single where clause.  So, for example, if you want to only return records where the visible checkbox is checked, and the category is news, you can set your where clause like this:

'where'  =>  "visible = 1 AND category = 'news'",

In this example, both need to be true in order to return a record.

Hope this helps

---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By dlsweb - September 25, 2013

Thanks for the help.  Got it figured out