我有一个带有 2 个参数的函数。这里是
function listBoats($con,$table){
//get record set for all boats sort them by their "sort" number
$queryBoat = "SELECT * FROM " .$table. " WHERE `id` <> 'mainPage' ORDER BY `sort` LIMIT 0, 1000";
$result = mysqli_query($con,$queryBoat);
return $result;
}
我是这样称呼它的
$result = listBoats($con,"CSINSTOCK"); //run query to list all the boats in the CSINSTOCK table
我无法让它工作。但是,如果我$table = "CSINSTOCK"
在函数中添加变量,它确实可以工作。为什么函数不会通过"CSINSTOCK"
变量?