当我试图获得“已售出”和“特色”的价值时,我什么也得不到。我究竟做错了什么?
function list_products($sold = false, $featured = false) {
global $link;
$result = mysqli_query($link, "SELECT * FROM products product JOIN images image ON product.id = image.product_id WHERE product.main_image = image.id AND product.sold = $sold AND product.featured = $featured") or die(mysqli_error($link));
}
list_products(false, true);
编辑:如果我尝试回显 $sold 或 $featured,它们是空白的。应该显示 1 或 0。