Hello,
The following code works fine on my computer but when I upload it to 000webhost, it does not work and gives an error.
The code is as follows.
$sql="SELECT Author, Tragedy FROM plays WHERE Author='Aeschylus'";
$result = $conn->query($sql);
if ($result->num_rows > 0)
{ echo "<table><tr><th>Author</th><th>Name of tragedy</th></tr>";
while($row = $result->fetch_assoc())
{ echo "<tr><td>".$row["Author"]. "</td><td><i>" . $row["Tragedy"]."</i></td></tr>";
}
}
The error is as follows
Trying to get property of non-object in /storage/ssd1/...
on the line for this
$result = $conn->query($sql);
Please help. I am a newbie.