我想動態創建sql
查詢,具體取決於我從用戶接收到的數據。動態創建sql查詢
代碼:
$test = $_POST['clientData']; //It can be an array of values
count($test); //This can be 2 or 3 or any number depending upon the user input at the client
$query = "select * from testTable where testData = ".$test[0]." and testData = ".$test[1]." and . . .[This would vary depending upon the user input]"
是否有可能實現上述方案。我在這方面比較新,你的指導將會有所幫助。
我想這是'PHP'並沒有那麼多'SQL'有關? –
是的,我通過PHP發射sql查詢。只是添加了PHP tag.Thanks。 – Ravikanth
$ test是一個數組? –