I have added to an sql database some images and some other data using php. Now I want to retrieve them and post them to a table using php.The table will have multiple rows. I want on the first cell of the row the image and on the next a list of data.The table will have multiple rows. I have managed to post the data correctly but not the image. I have searched a few post and tried some methods but no solution. Can you assist me? I post the code next:
<?php
session_start();
$pagetitle="Fleet";
include_once('head.php');
include_once('navbar.php');
connectDB();
?>
</head>
<?php
//DISPLAY A LIST OF ALL Files
$sql = "select * from Fleet";
$result = mysqli_query($mydb, $sql) or die(mysqli_error($mydb));
?>
<table width="600" border="0" cellpadding="1" cellspacing="1">
<?php
while($Fleet=mysqli_fetch_assoc($result)){
echo"<tr>";
echo "<td><img src='images/".$row['image']."'></td>";
echo"<td><ul><li><b>".$Fleet['Name']."</li>";
echo"<li>".$Fleet['AircraftRange']."</li>";
echo"<li>".$Fleet['Length']."</li>";
echo"<li>".$Fleet['Height']."</li>";
echo"<li>".$Fleet['WingSpan']."</li>";
echo"<li>".$Fleet['Passengers']."</li>";
echo"<li>".$Fleet['Payload']."</li></td>";
echo"</tr>";
}
?>
<?php
include_once('footer.php');
include_once('scripts.php');
?>
This is wrong:
$row['image'];
Should be:
$Fleet['image'];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.