A
Anonymous
Guest
Hi
I know I should probably be saving the image to a directory but I am not able to get that to work using godaddy. However I am able to load the image to the database. I can even get the image to display with out my other fields and vice versa. I can display the data from the table but I am not able to get the images and data to display together. Here is my code that I am trying to use.
When I do this I am getting the following error.
[01-Apr-2020 02:10:13 UTC] PHP Parse error: syntax error, unexpected 'data' (T_STRING), expecting ',' or ';' in /home/rsv4xn77f3dc/public_html/view_menu.php on line 22
I know I should probably be saving the image to a directory but I am not able to get that to work using godaddy. However I am able to load the image to the database. I can even get the image to display with out my other fields and vice versa. I can display the data from the table but I am not able to get the images and data to display together. Here is my code that I am trying to use.
Code:
<html>
<head>
</head>
<body>
<?php
// Include the database configuration file
require_once 'con_php.php';
//check connection
if ($con -> connect_error){
die ("connection failed: " . $con -> connect_error);
}
$sql = "SELECT * FROM dish_pic where cat_name = 'Chicken'";
$result = $con ->query($sql);
if ($result-> num_rows >0){
echo "<table><tr><th>Dish Name</th><th>Dish Description</th><th>Dish Size</th><th>Calories</th><th>Total Carbs</th><th>Net Carbs</th><th>Fat</th><th>Fiber</th><th>Protein</th><th>Recommended Side</th><th>Price</th><th></th>";
while ($row = $result -> fetch_assoc()){
echo"<tr><td> ". $row["dish_name"] . "</td><td>" . $row["dish_desc"] . "</td><td>" . $row["dish_size"] . "</td><td>" . $row["dish_cal"] . "</td><td>" . $row["dish_tot_carbs"] . "</td><td>" . $row["dish_net_carbs"] . "</td><td>" . $row["dish_fat"] . "</td><td>" . $row["dish_fiber"] . "</td><td>" . $row["dish_protein"] . "</td><td>" . $row["dish_recommend"] . "</td><td>" . $row["price"] . "</td><td> <img src="data:image/jpeg;base64,'.base64_encode($row['name'] ).'" height="200" width="200" class="img-thumnail" /></td></tr>";
}
echo"</table>";
}
else {
echo"0 results";
}
$con->close();
?>
</body>
</html>
When I do this I am getting the following error.
[01-Apr-2020 02:10:13 UTC] PHP Parse error: syntax error, unexpected 'data' (T_STRING), expecting ',' or ';' in /home/rsv4xn77f3dc/public_html/view_menu.php on line 22