I wasn't sure how to title this. Here's my challenge:
I have an array of 10 checkboxes to select categories for a search.
The checkboxes are passing INT values from the form. The search
function then needs to apply the checked catgeories as conditions on
the query. I couldn't figure out how to pass an array as the
$conditions value itself. The closest I've been able to come is doing
an implode on the array to create a string for $conditions. The
problem is that the array values and, more importantly, the field the
condition is applied to are INT. Cake is building the query like so:
... WHERE (`Bid`.`industry_id` IN ('400,402,403') )
That's fine except that MySQL seems to be choking because of the
single quotes and only searching on the first value (WHERE industry_id
= 400 in this example). I confirmed this by running the query
directly against the database. After removing the single quotes
around the list of INTs - [WHERE (`Bid`.`industry_id` IN
(400,402,403) )] - it finds everything as it should.
Long way to get to this question: Is there any way I can pass an
array of INTs for the $conditions on findAll instead of a string or
get MySQL to properly accept the array of INTs in string form?
Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---