Question

I have a table that shows products from my database. However the last column "image" is bringing up my images really big and making my table look all horrible. How can I define the width and height so image come out smaller.

echo "<table border='1'>
<tr>
<th>DEL</th>
<th>Name</th>
<th>Occasion</th>
<th>Style</th>
<th>Colour</th>
<th>Filling</th>
<th>Topping</th>
<th>Price</th>
<th>Image</th>


</tr>";

while($row = mysql_fetch_array($result))

  {
      ?>
   <td align="center" bgcolor="#FFFFFF"><input name="delete_these[]" type="checkbox" id="checkbox[]" value="<?php echo $row['cakeid']; ?>"></td>
   <?php
  echo "<td>" . $row['name'] . "</td>";
 echo "<td>" . $row['occasion'] . "</td>";
  echo "<td>" . $row['style'] . "</td>";
  echo "<td>" . $row['colour'] . "</td>";
  echo "<td>" . $row['filling'] . "</td>";
  echo "<td>" . $row['topping'] . "</td>";
echo "<td> £" . $row['price'] . "</td>"; 

 echo '<td><img src=" '. $row['images'] .  ' "/></td>';

  echo "</tr>";
  }
echo "</table>";
Was it helpful?

Solution

You need to use html tag styles, e.g:

echo '<td><img src="'. $row['images'] .  '" width="50" height="50" /></td>';

PS. you also need to remove whitespaces in img tag "src",( i've removed it in my example)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top