I m trying to pass in an unknown number of parameters (from 1-10) using an array to prepare my SQL statement for execution in PHP.
function executeStatement ($myArray) {
//for example, $myArray = ("one", "two", "three")
$qry = "SELECT * FROM table WHERE FieldA LIKE ".$myArray[0]." OR FieldA LIKE ".$myArray[1]." OR FieldA LIKE ".$myArray[2].";
$result = mysql_query($qry) or die("Query failed with error: ".mysql_error());
}
在使用阵列的N数参数中采用何种有效方法?