This is the database that is interacting with Android App also.
My other database tables data are working but one of the table is not able to be fetched on the HTML page.
Error: Trying to get property of non-object in C:\xampp\htdocs\tutorial\trydata01\testt.php on line 39 0 result
PHP CODE:
<!DOCTYPE html>
<html>
<head>
<title>Table with database</title>
<style type="text/css">
table {
border-collapse: collapse;
width: 100%;
color: #d96459;
font-family: monospace;
font-size: 25px;
text-align: left;
}
th{
background-color: #588c7e;
color: white;
}
</style>
</head>
<body>
<table>
<tr>
<th>OrderId</th>
<th>OrderStatus</th>
<th>OrderPrice</th>
<th>OrderDetail</th>
<th>OrderComment</th>
<th>OrderComment1</th>
<th>UserPhone</th>
</tr>
<?php
$conn = mysqli_connect("localhost", "root", "", "wcfood01");
if ($conn-> connect_error) {
die("Connection failed:". $conn-> connect_error );
}
$sql = "SELECT * from order";
$result = $conn-> query($sql);
if ($result-> num_rows > 0) {
while ($row = $result-> fetch_assoc()) {
echo "<tr><td>". $row["OrderId"] ."</td><td>". $row["OrderStatus"] ."</td><td>". $row["OrderPrice"] . "</td><td>". $row["OrderDetail"] . "</td><td>". $row["OrderComment"] ."</td><td>". $row["OrderComment1"] ."</td><td>". $row["UserPhone"] ."</td></tr>";
}
echo "</table>";
}
else{
echo "0 result";
}
$conn-> close();
?>
</table>
</body>
</html>