0
我試圖從訂單表中打印出Product_Name和Order_Date,但不斷收到第35行的錯誤「num_rows線」。嘗試在內部連接語句上嘗試獲取非對象屬性的錯誤
<?php
$servername = "localhost";
$username='root';
$password = "";
$dbname = "login";
?>
<html><<html>
<head>
<title>Cart</title>
<link rel="stylesheet" href="tabMenu.css" type="text/css">
</head>
<body>
</body>
</html>
<?php
$mysqli = new mysqli($servername,$username, Null, $dbname);
// Check connection
if ($mysqli->connect_error) {
die("Connection failed: " . $mysqli->connect_error);
}
session_start();
$results="Select orderline.Order_Date,p.Product_Name"
. "from orderline"
. "inner join product p"
. "on orderline.Product_ID=p.Product_ID";
$num=$mysqli->query($results);
if ($results->num_rows)
{
while ($row=$results->fetch_object())
{
echo "{$row->Order_Date} {$row->Product_ID} <br>";
}
}
else
{
echo "No Results";}
在此先感謝任何幫助將是偉大的。