1

I have query like this

SELECT * FROM table WHERE id ='1'

but in column id store data like this

array (size=2)
   0 => string '1' (length=1)
   'id' => string '1' (length=1)
array (size=2)
   0 => string '1,2' (length=3)
   'id' => string '1,2' (length=3)
array (size=2)
   0 => string '1,2,3' (length=5)
  'id' => string '1,2,3'

Result of my query is show only 1 row but what I need is show every row that has value 1 in it.

plz help me with it

koe
  • 736
  • 1
  • 12
  • 33
  • possible duplicate of [mysql check if numbers are in a comma separated list](http://stackoverflow.com/questions/2674011/mysql-check-if-numbers-are-in-a-comma-separated-list) – Kanishka Panamaldeniya Oct 19 '14 at 17:11

2 Answers2

1

I think you can use LIKE %% to achieve this

SELECT * FROM table WHERE id LIKE '%1%'
Fabio
  • 23,183
  • 12
  • 55
  • 64
0

Pull from the table as the current data, then:

 $NewArr = array();
 foreach ($Array as $values){
      $NewArr[] = (int) @values;

 }
Daryl Gill
  • 5,464
  • 9
  • 36
  • 69