Where Statement Issue

3 posts by 2 authors in: Forums > CMS Builder
Last Post: October 2, 2011   (RSS)

By MickC - October 1, 2011

Hi guys,

I am trying to limit my page results to the following criteria:

'Approved'= 1 (checked)
'sales_status' = "in Stock" or "Coming In"

here is my current page query:

list($listingsRecords, $listingsMetaData) = getRecords(array(
'tableName' => 'listings',
'perPage' => '6',
'where' => 'sales_status="In Stock" OR sales_status="Coming In"' and 'approved="1"',


I cant get it to limit it so that all criteria are checked.

I can get it to show the right "sales_status" records, but it ignores the "approved" check.

If I reverse the order of the statement, it show approved records only, but only "in stock" records.

i.e, the AND part is working, and the OR part is working, but not both at the same time.

Im sure its just the way I have the statement worded, but can only find references to WHERE / AND statements, not WHERE / AND /OR statement

Re: [Dave] Where Statement Issue

By MickC - October 2, 2011

Top Job Dave,

That was it!

I can see now why it wasn't working correctly

Thanks mate