I created a database and a table in that called 'Recipe', and I manually added contents to that table. It contain an image column also.
I wanted to display the table and pass it through JSON. I don't know how to display image.
My code is:
<?php
include("connection.php");
$query = "SELECT * FROM Recipe";
if ($result=mysqli_query($link, $query)) {
$number = mysqli_num_rows($result);
echo "<table cellpadding=\'0' cellspacing='0' class='db-table'><tr>
<th>Recipe name</th>
<th>Photo</th>
<th>Steps</th>
</tr>";
while($recipe=mysqli_fetch_assoc($result)){
echo "<tr>";
echo "<td>".$recipe['Recipe_name']."</td>";
echo "<td><img src='".getImage.php?id=1."' width='175' height='200'</td>" ;
echo "<td>".$recipe['Recipe_steps']."</td>";
echo "</tr>";
}
echo "</table>";
} else {
echo "It failed";
}
?>