1

I have table A and an array.

A

+----+-------+-------+--------+
| id | data1 | data2 | number |
+----+-------+-------+--------+
| 1  | xxx   | mmm   | 2      |
+----+-------+-------+--------+
| 2  | abc   | hij   | 4      |
+----+-------+-------+--------+
| 3  | qwe   | lol   | 3      |
+----+-------+-------+--------+
| 4  | asd   | pip   | 2      |
+----+-------+-------+--------+
| 5  | zui   | aaa   | 4      |
+----+-------+-------+--------+
| 6  | yxc   | ert   | 4      |
+----+-------+-------+--------+
| 7  | lop   | flo   | 3      |
+----+-------+-------+--------+
| 8  | foo   | zzz   | 1      |
+----+-------+-------+--------+

array

$arr = array("0", "1", "2", "3");

Now I want to get all data from A where number exists in $arr.

So the result should be:

id data1 data2
1  xxx   mmm   
3  qwe   lol
4  asd   pip
7  lop   flo
8  foo   zzz

Rows like:

id data1 data2
2  abc   hij
5  zui   aaa

Are not in the result, because their number is 4 and not in $arr.

Jakob
  • 1,858
  • 2
  • 15
  • 26

0 Answers0