Hi,
I am trying to develop sort of like a directory.. but i can get my image to display.. I know it is in my code, but i am really new to php (only 2 weeks) everything else in the database displays but not my image..? I have set my table field that holds the image to longblob and i can upload images to this database.... i just cannot display it...please can you help??
Here is my php code, please be king as i am very new to php... and i know that the code is very simple to you. The name of the image column is 'photo'
<html>
<style type="text/css">
<!--
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: normal;
color: ##000000;
background-color: #FFFFFF;
}
font { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; color: ##000000}
tbody {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: ##000000;
}
.style1 {color: #000000}
-->
</style>
<body>
<span class="style1"><a href="javascript:history.go(-1);"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Go
back to Search</font></a>
</span>
<p class="style1"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Your
Search produced the following results:</font></p>
<p> </p>
<p> <font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<?php
mysql_connect (localhost, root, password);
mysql_select_db (directory);
if ($townorcounty == "")
{$townorcounty = '%';}
if ($county == "")
{$county = '%';}
$result = mysql_query ("SELECT * FROM company
WHERE (town LIKE '$townorcounty%'
OR county LIKE '$townorcounty%')
");
if (!mysql_num_rows($result)) {
print('No search results');
}
else {
print('<table border=0 cellpadding=0 cellspacing=10>');
print('<tr>');
print ("<td><div align=center><strong>Company Name</strong></div></td>");
print ("<td><div align=center><strong>Title</strong></div></td>");
print ("<td><div align=center><strong>Town</strong></div></td>");
print ("<td><div align=center><strong>Tel</strong></div></td>");
print ("<td><div align=center><strong>Photo</strong></div></td>");
print ("</tr>");
while ($row = mysql_fetch_array($result)) {
print('<tr><td>');
print $row["Company"];
print ("</td><td> ");
print $row["title"];
print ("</td><td> ");
print $row["town"];
print ("</td><td> ");
print $row["tel"];
print ("</td></tr>");
print $row["photo"];
print ("</td></tr>");
}
print('</table>');
}
?>
</font> </p>
</body>
</html>
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 🙂