Unable to create the right query
I need a little help. I am trying to fetch records from database on a
certain critera but unable to make the exact logic that will work out.
Like i have a table in which i am storing some ids like
1,14,23,45,17,8,9,11 etc
I receive an array like this
1,2,19,45,56,65
What I thought was to explode the array and match the individual indexes
to the column in database. But here is the problem..
If I use
Like %value% query, it returns non required results for example if we run
SELECT *
FROM `table`
WHERE `table_skills_id` LIKE '%2%'
LIMIT 0 , 30
You can see that 2 was not in the initial array or column that I wrote
above but because 23 was present there, it responded that there is one
result matching where as it should have said 0 rows matching
What I want is that it matches the whole number rather than matching them
seperately. I have tried "Like %2" as well as "Like 2%" but none of them
works properly.
Any quick help would be highly appreciated.
Thanks.
No comments:
Post a Comment