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:
(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!!!
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:
Hope this helps.
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/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Search/Where upload is blank
By rjbathgate - June 23, 2010
Thanks for the reply...
Yeah I thought that would be the case as its a seperate table.
If i run a foreach and then 'ignore' non image ones, it messes with a whole bunch of other stuff (page nav etc), so I'd have to look at using that first foreach to create a new array and then run the results based on that...
Thanks anyway, I'll give it some thought and play around
Cheers
Yeah I thought that would be the case as its a seperate table.
If i run a foreach and then 'ignore' non image ones, it messes with a whole bunch of other stuff (page nav etc), so I'd have to look at using that first foreach to create a new array and then run the results based on that...
Thanks anyway, I'll give it some thought and play around
Cheers