-3

I have a string of ids like tsid = '1,2,3,4'

Now i want to match this tsid with a column of a mysql database. The values in column ia also comma separated like this '1,2,3,4,5,6,7,8,9,10'

Now i want a sql query which finds the tsid in a column.

I have tried tsid like '%".$tsIdsAll."%'" But this is not fetching right result.How to do this?

Thanks

New user
  • 11
  • 4

1 Answers1

0
  1. convert both normal and db strings into an 2 arrays using explode.

  2. then perform array_diff().

  3. u find the results easily.

White Marcus
  • 195
  • 2
  • 3
  • 12