Search/Where upload is blank

3 posts by 2 authors in: Forums > CMS Builder
Last Post: June 23, 2010   (RSS)

By rjbathgate - June 22, 2010

Hello,

This is probably quite simple but I'm having a blank...

I have a listing page, with a field amongst others 'photographs', which is an UPLOAD field.

How can I return results where there IS an upload for said field? (and also, where there ISN"T an upload for said field)

For example:
'where' => "photographs = '1'",
(that doesn't work by the way!)

I need to use said criteria in a GET search engine, i.e. results.php?photographs=1

and also in a SQL WHERE query.

Thanks!!!

Re: [rjbathgate] Search/Where upload is blank

By Jason - June 23, 2010

Hi,

The way CMS Builder works is it doesn't actually store upload information in the database section you create. Instead it puts all upload information in another table called uploads (you can't see it as a section). These uploads are loaded automatically when you use the getRecords function.

What you can do is return all records (whether they have an upload or not) and then you can use code to check each record.
For example:

<?php foreach ($productRecords as $record): ?>
<?php if($record['photographs']):?>
*RECORD HAS UPLOADS IN PHOTOGRAPHS FIELD*
<?php else: ?>
*RECORD DOESN'T HAVE UPLOADS IN PHOTOGRAPHS FIELD*
<?php endif ?>
<?php endforeach ?>


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/