我正在建立一个字符串,我检查mysql数据库。php mysql查询字符串数组
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)"
我会想添加单引号和逗号阵列,这样我有这样的字符串数组: “从我的表中选择*,其中ID在(‘STRING1’,‘字符串2’,” string3')“
我试过使用数组implode,但仍然没有运气有任何想法?感谢
谢谢!奇迹般有效。 – NULL 2010-04-14 13:50:21
工作得很好!我想问一个问题,正在做的点是什么,它们是否像“+”一样将引号与implode结果粘合起来? – deckoff 2012-10-29 20:44:34
@deckoff Exacly。 – hsz 2012-10-29 21:41:53