私は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"
関数が変数を渡さないのはなぜですか?