Comparing string from array with mysql field
Hi, i have one problem with my search script
i have multiple checkboxes in search form, when user check eg. 5 boxes, after form process i take array and implode that array into one string and i get eg. $implodString = 1|4|27|34|55;
So, what i need is a way to compare this with mysql field where i have just one value eg. |4| - (this is in my field).
I need something like this
SELECT FROM `TABLE` WHERE `FIELD` LIKE %$implodString%
with showen values looks like this
SELECT FROM `TABLE` WHERE `|4|` LIKE % 1|4|27|34|55 %
i need to find all fields where we have any number from imploded array, in this case i need all fields where we have number 1,4,27,34 or 55.
Thank you for help.
I got something, this checks 2 rows,
Would the IN() function of MySQL be a better approach to the problem.
lol, tnx, i total forgot on IN(),
Firstly i was looked a way to compare two array srings eg. 2,4,6,9 compare with 5,3,2,4,7,8, but i cant find way to do that, so i add just one value in field and i just continue to write and forgot IN(), if u have any suggestion on how to compare 2 different array please write, (it will be a case when these 2 arrays wouldnt have same number of values inside, eg. 3,4,5 and 5,6,4,2 - in 1 array we have 3 values and in sec. we have 4.)
|All times are GMT. The time now is 05:52 AM.|
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0