Checking multiple fields for displaying lists.
8 posts by 2 authors in: Forums > CMS Builder
Last Post: November 24, 2008 (RSS)
$options['where'] = 'offering_type_1 = "Generations"'; // (ADVANCED) Additional MySQL WHERE conditions. Example: 'fieldname = "value"'
I would like for the system to check ALL fieldnames for the information in quotes, and display all the records that would match. Is there a PHP/MySQL wildcard that can do this?
I checked in with a programming friend who made the following (unsuccessful) recommendation:
you can not use wildcards in fieldnames.
You can use the OR statement in the query.
Example:
$options['where'] = ' offering_type_1 = "Generations" OR fieldname2 = "Generations" OR fieldname 3= "Generations" ';
I replied with:
I gave the "OR" statement a try, but it's not pulling all of the information properly. It only reads the first option and ignores the rest.
He then made the following (unsuccessful) recommendation:
$options['where'] = ' ( offering_type_1 = "Generations" OR fieldname2 = "Generations" OR fieldname 3= "Generations" ) ';
I replied with:
That didn't work either. I tried it with the quotes as listed, and it gave me an error. When I put each option in its own set of brackets, it wouldn't render the page or return an error.
Is there a way to check multiple or all fields in a table to display in a list?
Thanks,
T
Re: [tsuluwerks] Checking multiple fields for displaying lists.
By Dave - November 19, 2008
Looks like you're using an older version of CMS Builder. We've updated the generated code a bit. That's bit though it's similar and will still work.
Try this:
$options['where'] = ' ( offering_type_1 LIKE "%Generations%" OR fieldname2 LIKE "%Generations%" OR fieldname3 LIKE "%Generations%" ) ';
LIKE lets you use wildcards such as % which mean (any number of characters).
This can also be put in the url like this:
yourViewer.php?offering_type_1,fieldname2,fieldname3_keyword=Generations
You can read more about the build in url searching features here:
http://www.interactivetools.com/docs/cmsbuilder/viewer_search.html
Hope that helps!
interactivetools.com
Re: [Dave] Checking multiple fields for displaying lists.
T
Re: [tsuluwerks] Checking multiple fields for displaying lists.
By Dave - November 19, 2008
I'd upgrade your clients one at a time just to make sure everything goes smoothly. But we've made the upgrade process simpler so now you can just upload all the folders instead of worrying about which ones should and shouldn't be uploaded.
interactivetools.com
Re: [Dave] Checking multiple fields for displaying lists.
Re: [tsuluwerks] Checking multiple fields for displaying lists.
By Dave - November 21, 2008
interactivetools.com
Re: [Dave] Checking multiple fields for displaying lists.
T
Re: [tsuluwerks] Checking multiple fields for displaying lists.
By Dave - November 24, 2008
interactivetools.com