使用php从mysql获取所有字段值

zah*_*in 4 php arrays filter

我想知道如何让所有字段值按数组搜索.

我有阵列s

我的桌子是

  id   content

  1    zahr
  2    hai
   .
   .
   .
  and so on


$a = {2,3,4,5,43,32};

i have to take the contents by this id(from array "a").

i know, i can use "for" loop for getting each element from mysql.

but i would like to use any filters or any predefined function
Run Code Online (Sandbox Code Playgroud)

谢谢并提前

oez*_*ezi 6

SELECT * FROM table WHERE id IN (2,3,4,5,43,32)
Run Code Online (Sandbox Code Playgroud)

可以使用implode创建语句,如:

$myvar = '('.implode(',',$a).')';
Run Code Online (Sandbox Code Playgroud)

然后

SELECT * FROM table WHERE id IN $myvar
Run Code Online (Sandbox Code Playgroud)