php mysql查询字符串数组

NUL*_*ULL 2 php mysql arrays string

我正在构建一个我在mysql db中检查的字符串.

eg:
formFields[] is an array - input1 is: string1
array_push(strings, formFields)
1st string and mysql query looks like this:
"select * from my table where id in (strings)"

formFields[] is an array - input2 is: string1, string2
array_push(strings, formFields)
2nd string and mysql query looks like this:
"select * from my table where id in (strings)"

formFields[] is an array - input3 is: string1, string2,string3
array_push(strings, formFields)
3rd string and mysql query looks like this:
"select * from my table where id in (strings)"
Run Code Online (Sandbox Code Playgroud)

我想在数组中添加单引号和逗号,以便为数组字符串添加:"select*from my table where id in('string1','string2','string3')"

我尝试使用阵列内爆,但仍然没有运气任何想法?谢谢

hsz*_*hsz 7

'SELECT ... WHERE id IN ("' . implode('","', $strings) . '")';
Run Code Online (Sandbox Code Playgroud)