So if you feel the question is repeated ,I have tried other solutions but not working.I have link of images stored in Database(phpMyAdmin) as string.I want to load the image as a part of the second column of a table from DB using the links.
<table style="width:100%" id="to1">
<tr>
<th>ID</th>
<th>Featured Image</th>
<th>Title</th>
<th>Brand Name</th>
<th>Price</th>
<th>Quantity</th>
<th>Shipping Cost</th>
<th>Delivery Time </th>
<th>Delivery Distance</th>
</tr>
<?php
$conn = mysqli_connect("localhost","root", "", "products");
if ($conn-> connect_error){
die("Connection Failed: ". $conn-> connect_error);
}
$sql = "SELECT id,featured_image,title,brand_name,price,quantity,shipping_cost,delivery_time,delivery_distance from products";
$result = $conn-> query($sql);
if ($result-> num_rows > 0){
while ($row = $result-> fetch_assoc()){
$val = $row["featured_image"];
echo "<tr><td>".$row["id"] ."</td><td>". '<img src='<?= **HERE** ?>' alt="">' ."</td><td>".$row["title"] ."</td><td>".$row["brand_name"] ."</td><td>".$row["price"] ."</td><td>".$row["quantity"] ."</td><td>".$row["shipping_cost"] ."</td><td>".$row["delivery_time"] ."</td><td>".$row["delivery_distance"] ."</td></tr>";
}
echo "</table>";
}
else{
echo "0 tables";
}
$conn-> close();
?>
I have shown the place as here .please suggest some ways so that I can show images instead of links in the table. Here is what I want it to look like.
I think, you had quotes problems:
UPDATED:
echo "<tr><td>".$row["id"] ."</td><td><img src='".$row["featured_image"]."' alt=''></td><td>".$row["title"]."</td><td>".$row["brand_name"]."</td><td>".$row["price"]."</td><td>".$row["quantity"]."</td><td>".$row["shipping_cost"]."</td><td>".$row["delivery_time"]."</td><td>".$row["delivery_distance"] ."</td></tr>";
echo "
<tr>
<td>.$row["id"].</td>
<td>.<img src='$row["featured_image"]' alt="">.</td>
<td>.$row["title"].</td>
<td>.$row["brand_name"].</td>
<td>.$row["price"].</td>
<td>.$row["quantity"].</td>
<td>.$row["shipping_cost"].</td>
<td>.$row["delivery_time"].</td>
<td>.$row["delivery_distance"].</td>
</tr>"
Try this
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.