SQL where clause

4 posts by 2 authors in: Forums > CMS Builder
Last Post: April 11, 2011   (RSS)

Re: [Duches77] SQL where clause

By Dave - April 9, 2011

Hi Duches77,

Is the 'category' field a multi-value list field? If so it stores multiple values in a tab separated list, so the where needs to be a little different:

'where' => " category LIKE '%\tFundraising Raffles\t%' ",

Or, if it works to have that in the url you can make use of the automatic searching features with:

yourViewer.php?category=Fundraising Raffles

But, if neither of those work, the next step in debugging the problem would be to look at the data being returned and compare it to the where.

list($eventsRecords, $eventsMetaData) = getRecords(array(
'tableName' => 'events',
'perPage' => '25',
#'where' => 'category = "Fundraising Raffles"',
));

showme($eventRecords);
exit;


And to check what the value of 'category' is.

Let me know if any of those help or how far you get. Thanks!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] SQL where clause

By JLynne77 - April 11, 2011

Thanks, Dave. That first option with the LIKE operator worked perfectly to keep with the client's preferences on how they want the site laid out. :)
-----
~Jessica Sullivan, Crystal Realm Designs.

Re: [Duches77] SQL where clause

By Dave - April 11, 2011

Great, glad I could help! :)
Dave Edis - Senior Developer
interactivetools.com