Page 1 of 1

How to use alphanumeric array for IN clause in PDO

Posted: Thu Jun 26, 2014 6:10 am
by pooja1110
I have check boxes with values like - 2610, 1234, 2200MSR, 2200MSTY, MAko, Stack-TA.. etc

Thn have this PDO query in which I am checking this alphanumerical array against family.

Code: Select all

SELECT SUM( IF( STATUS = :status, 1, 0 ) ) passed_count FROM tooldata WHERE family IN ('.$family_implode.') AND startTime >= :date GROUP BY family ORDER BY family' );
Now here when ever I selected any alphanumeric value my query does not work properly. For example .. If I check 2200MSR, I get the data for all the array values having 2200, i.e., 2200MSR, 2200MSTY, Moreover when I select Mako, stack-ta I don't get any output.

How this can be resolved. Please guide.

Re: How to use alphanumeric array for IN clause in PDO

Posted: Thu Jun 26, 2014 6:26 am
by Celauran
What does your $family_implode look like? Are you getting errors or just bad data?

Re: How to use alphanumeric array for IN clause in PDO

Posted: Thu Jun 26, 2014 6:33 am
by pooja1110
It has all the correct values. If I select 2200MSI, it shows the same but the problem is with the query.. Where I am using IN clause .. Its taking all the values which have 2200