我正在建立一個字符串,我檢查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