我有一个产生此错误的 PHP 函数:
Missing argument 1 for show_products(), called in
C:\server\htdocs\php\index.php on line 21
这是PHP代码:
function show_products($cat){
if(isset($cat)){
$sql = "SELECT * FROM `PRODUCTS` WHERE cat = '$cat'";
} else {
$sql = "SELECT * FROM `PRODUCTS` WHERE 1";
}
$query = mysql_query($sql);
if($query){
while ($product = mysql_fetch_array($query)) {
echo $product['name'] . " - " . $product['price'] . "<br />";
}
}
else {
echo "No Product found!";
}
}
我这样调用函数:
show_products()
这个错误是什么意思?