Home | Products | Consulting | Forums | Support | Order | 1-800-752-0455
  Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
Checking multiple fields for displaying lists.

 

 


tsuluwerks
User

Nov 19, 2008, 2:18 PM

Post #1 of 8 (799 views)
Shortcut
Checking multiple fields for displaying lists. Can't Post

The system allows us to put in WHERE statements, ie:
$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:

Code
 $options['where']      =   '   offering_type_1 = "Generations"   OR fieldname2 = "Generations" OR  fieldname 3= "Generations"      ';


I replied with:

Quote
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:


Code
$options['where']      =   '   (  offering_type_1 = "Generations"   OR fieldname2 = "Generations" OR  fieldname 3= "Generations"    )  ';


I replied with:

Quote
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


Dave
Staff / Moderator


Nov 19, 2008, 2:49 PM

Post #2 of 8 (798 views)
Shortcut
Re: [tsuluwerks] Checking multiple fields for displaying lists. [In reply to] Can't Post

Hi T,

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!

Dave Edis - Senior Developer
interactivetools.com


tsuluwerks
User

Nov 19, 2008, 3:37 PM

Post #3 of 8 (796 views)
Shortcut
Re: [Dave] Checking multiple fields for displaying lists. [In reply to] Can't Post

Thanks Dave. I'll give it a try. I have another client using a newer version, and it's much easier. What can we do to get the latest version for all of our clients?

T


Dave
Staff / Moderator


Nov 19, 2008, 3:39 PM

Post #4 of 8 (794 views)
Shortcut
Re: [tsuluwerks] Checking multiple fields for displaying lists. [In reply to] Can't Post

Upgrades are by donation and you can download the latest zip here: http://www.interactivetools.com/upgrade/

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.

Dave Edis - Senior Developer
interactivetools.com


tsuluwerks
User

Nov 21, 2008, 8:44 AM

Post #5 of 8 (777 views)
Shortcut
Re: [Dave] Checking multiple fields for displaying lists. [In reply to] Can't Post

the LIKE statement isn't working either. We're having a similar issue on another page. I hope to figure this out or find an alternative solution.


Dave
Staff / Moderator


Nov 21, 2008, 3:12 PM

Post #6 of 8 (775 views)
Shortcut
Re: [tsuluwerks] Checking multiple fields for displaying lists. [In reply to] Can't Post

I'm pretty sure that code is valid. What is it doing? Just not returning any results? Can you attach the viewer file to this post so we can see the code?

Dave Edis - Senior Developer
interactivetools.com


tsuluwerks
User

Nov 24, 2008, 10:59 AM

Post #7 of 8 (741 views)
Shortcut
Re: [Dave] Checking multiple fields for displaying lists. [In reply to] Can't Post

Hi, Dave, we found that the viewer works if we replace LIKE with OR. Thanks for your help!
T


Dave
Staff / Moderator


Nov 24, 2008, 1:33 PM

Post #8 of 8 (734 views)
Shortcut
Re: [tsuluwerks] Checking multiple fields for displaying lists. [In reply to] Can't Post

Great, glad it's working! :)

Dave Edis - Senior Developer
interactivetools.com

 
 
 


Search for (options)
Products
CMS Builder
Article Manager
Realty Manager
Listings Manager
Order Now
Services
Priority Consulting
Support
Online Documentation
Support Forums
Support Homepage
Company Info
12 reasons to choose us!
Meet the team
Monthly newsletter
Contact Us
Toll Free: 1-800-752-0455
Phone: (604) 689-3347
Sales | Support
Conditions of Use | Privacy Policy | Copyright © interactivetools.com 2008
#201 - 2730 Commercial Drive, Vancouver BC Canada V5N 5P4