Forum Moderators: coopster
Can anyone help me. I have this code which works fine for what I want BUT I want the row/ field to start by showing the villa image which are uploaded in my mysql database as a BLOBs stored as .gifs. I want all the images stored on the database.
The images are are in a field called 'pix' at the end of 8 other fields called villaID, villaName, villaDescription etc.. so it's simply for my which is how I need it.
What do I need to add to the script to show the image. I am not very good at all this and do not want to change what I have already as it's taken me so long to get this far and I am exhausted!
I have tried by simply adding a row and typing 'pix' but as you would have guessed it shows binary I think.
Thanks guys for your help it is very much appreciated.
<?php
$db_host = "localhost";
$db_user = "";
$db_pwd = "";
$db_name = "";
mysql_connect($db_host, $db_user, $db_pwd);
mysql_select_db($db_name);
?>
<P style="font-family: 'Papyrus'; color: #151B8D;"><b>One bedroom villas in Spain</b></p>
<table style="width: 700px; height: line-height: 50px; font-family: 'arial'; color: #151B8D; text-align: left;">
<?php
$sql = "SELECT * FROM VillaCatalog WHERE villaType = 'one bedroom'";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query)) {
echo "<tr>";
echo "<td>".$row['villaName']."</td>";
echo "<td>".$row['villaDescription']."</td>";
echo "<td>".$row['villaCity']."</td>";
echo "<td>".$row['villaID']."</td>";
echo "</tr>";
}
?>
</table>
you could provide the image data inline by using the object tag with the data and type attributes, but that's not very friendly.