我想动态创建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是一个数组? –