SYNATAX HOW TO DISPLAY RESULTS FROM LISTINGS WHERE TWO CONDITIONS MUST EXIST

3 posts by 2 authors in: Forums > CMS Builder
Last Post: September 14, 2016   (RSS)

By kitka - September 13, 2016

Hi All...

I am reworking a site and cant remember how this is done...
http://www.genedco.com/listings2016.php

I am trying to get results listed based on  the following conditions.
where the results on show listing that have both the conditions exist.... both hide listings and cobourg must exist for the result to show up.

.here are 

// load records from 'listings'
list($listingsRecords, $listingsMetaData) = getRecords(array(
'tableName' => 'listings',
'loadUploads' => true,
'allowSearch' => true,
'where' => "hide_listing ='0'",
'where' => "content = 'cobourg'",

));

Can anyone help me with the correct code

jim albert

By Steve99 - September 14, 2016

Hello,

You can do this for your where statement:

// load records from 'listings'
 list($listingsRecords, $listingsMetaData) = getRecords(array(
 'tableName' => 'listings',
 'loadUploads' => true,
 'allowSearch' => true,
 'where'   => '`hide_listing` = "0" AND `content` = "cobourg"',
));

As a side note, I noticed you have that field "hide_listing". If you're looking to hide records there is a built in feature - if you name a checkbox field as "hidden" the CMS will automatically hide those records from showing on the front of your site.

Hope this helps!

Steve

By kitka - September 14, 2016

Steve...
thankyou very much.. it works fine now....

I coudn't remember the correct syntax...thanks again

jim albert