I am having issues with displaying the database table. My database table (activities) have the following value, ID (Primary Key), type, title, description and picture. I am trying to retrieve and display title,description and picture in a table format but is facing an error
"Notice: Undefined index: title, Notice: Undefined index: description and Notice: Undefined index: picture"
which I am unable to solve it. Below are my php code:
<div class="col-md-4 col-md-offset-1">
<div id="content">
<table><?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "sentosa_resort";
$conn = new mysqli($servername, $username, $password,
$dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$query = "SELECT title,description,picture FROM activites";
$result = $conn->query($sql);;
// start a table tag in the HTML
while($row=mysqli_fetch_array($result)){
$title = $row['title'];
$description = $row['description'];
$picture = $row['picture'];
echo "<tr>";
echo "<td>" . $title . "</td>";
echo "<td>" . $description . "</td>";
echo "<td>" . $picture . "</td>";
echo "</tr>";
}
?></table>
</div>
</div>