Mysql 'where' record has upload

2 posts by 2 authors in: Forums > CMS Builder
Last Post: August 5, 2016   (RSS)

By dm - July 28, 2016

hi

for some random featured listings on a home page i am limiting a list of records to 3 but i want to only display records where the upload field called "photos" has photos uploaded

is there a way to add to the 'where' clause below to achieve this via the mysql?

list($propertyRecords, $propertyMetaData) = getRecords(array(
'tableName' => 'property',
'limit' => '3',
'orderBy' => 'RAND()',
'loadUploads' => true,
'allowSearch' => false,
'useSeoUrls' => true,
'where' => "collection = '1'".' AND '."hide_property = '0'",
));

many thanks for the support!

By Damon - August 5, 2016

Hi,

is there a way to add to the 'where' clause below to achieve this via the mysql?

There is probably a way but it would be a very complex MySQL query. 

What about adding a "featured" checkbox for property records and a message after the checkbox to users to only check property as featured if property record includes images?

Cheers,
Damon Edis - interactivetools.com

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