Jump to content

[SOLVED] Display image from mysql database using php


xx_princess_xx

Recommended Posts

i am trying to display the image which i have stored as an URL in the database...

 

the table displays all information except for the photo,

 

$result = mysql_query("SELECT * FROM properties");

echo "<table border='1' padding='1'>
<tr>
<th>Property ID</th>
<th>Type</th>
<th>Price</th>
<th>Address</th>
<th>Post Code</th>
<th>Photo</th>
<th>Available</th>
<th>Agent ID</th>
</tr>";while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['pid'] . "</td>";
  echo "<td>" . $row['type'] . "</td>";
  echo "<td>" . $row['price'] . "</td>";
  echo "<td>" . $row['address'] . "</td>";
  echo "<td>" . $row['post_code'] . "</td>";
  echo "<td>" . $row['<img src=photo'] ."</td>";  //here is the part i am stuck with/////////
  echo "<td>" . $row['isavailable'] . "</td>";
  echo "<td>" . $row['agent_id'] . "</td>";
  echo "</tr>";
  }
echo "</table>";mysql_close($con);
?>

$result = mysql_query("SELECT * FROM properties");

echo "<table border='1' padding='1'>
<tr>
<th>Property ID</th>
<th>Type</th>
<th>Price</th>
<th>Address</th>
<th>Post Code</th>
<th>Photo</th>
<th>Available</th>
<th>Agent ID</th>
</tr>";while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['pid'] . "</td>";
  echo "<td>" . $row['type'] . "</td>";
  echo "<td>" . $row['price'] . "</td>";
  echo "<td>" . $row['address'] . "</td>";
  echo "<td>" . $row['post_code'] . "</td>";
  echo "<td><img src='" . $row['photo'] ."' /></td>";  //here is the part i am stuck with/////////
  echo "<td>" . $row['isavailable'] . "</td>";
  echo "<td>" . $row['agent_id'] . "</td>";
  echo "</tr>";
  }
echo "</table>";mysql_close($con);
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.