I was wondering if anyone can help me - I have a fairly simple problem and I was wondering if anyone could have a quick look at my code to see what is missing.
I have a database and I have one column called foto which holds the names of the fotos users insert ($foto_name), the actual file being placed on a folder on the server. This all works fine but when I want to get the image and display it in a results table the code doesn't recognise the existance of the image. I think I have missed off a simple line to let the php know that $foto_name is a variable and to treat it accordingly - but I can't find out how to do this.
<?php
include("../../connect.php");
$result = mysql_query("select * from db WHERE model
LIKE '%".$model."%' AND make LIKE '%".$make."%' AND
etc ......
or die (mysql_error() );
//Checks if any items are found and if so displays the result in a table
if (mysql_num_rows($result) == 0)
{
echo "Nada>";
}
else
{
while($row = mysql_fetch_array($result))
{
?>
<div align="center">
<font size="3" face="Arial, Helvetica, sans-serif">
<table width="80%" border="1" cellpadding="0">
<?
echo " <tr> \n";
... lots of table formatting ......
echo " <td colspan='3' rowspan='7'>"; echo "<div align=\"center\">"; echo "<img src=\"../../image_folder/$foto_name\" width=\"300\" height=\"200\"><br>\n"; echo "</div></td>\n";
..... lots more table formatting ......
echo " </tr>\n";
echo " </table>\n";
?>
</font></div>
<br>
<?
}
mysql_free_result($result);
}
?>
What have I missed out?? Or have I done something wrong in the line in the table that goes;
"<img src=\"../../image_folder/$foto_name\" ?
Many thanks to anyone who can help.
Jon