我的php代码中有以下内容
$query = "select ORDERS.order_id, PRODUCT.name, PRODUCT_ORDERS.quantity,
PRODUCT.sell_price, ORDERS.date from ORDERS, PRODUCT, PRODUCT_ORDERS where
ORDERS.order_id = PRODUCT_ORDERS.order_id AND PRODUCT.product_id =
PRODUCT_ORDERS.product_id and ORDERS.customer_id = $customer_id";
$results = mysqli_query($con, $query);
if (mysqli_query($con, $query)) {
echo "Successfully run query: $query";
} else {
echo "Invalid input error: " . $query . "<br>" . mysqli_error($con);
}
$num = mysqli_num_rows($result);
echo $num; //test to see if i get a number
我在mysql workbench中使用了相同的select语句,它工作并按预期返回4个结果。 PHP中是否有特定的东西我应该注意什么?谢谢。
答案 0 :(得分:2)
试试这个
$num = mysqli_num_rows($results);
echo $num;