I keep getting this message. I am simply trying to retrieve my table data from a sql db the line that is giving me the problem is: if ($result->num_rows > 0) {
In the code:
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$prodlist = "SELECT item number, item description FROM product";
$result = $conn->query($prodlist);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "Item Number: " . $row["item number"]. " - Item Description: " . $row["Item Description"]."<br>";
}
} else {
echo "0 results";
}
$conn->close();
?>
</body>
</html>