Hi, I am trying to output images in a table, and what I have is the filename for the picture in my database. My code works when I used a hard-coded test as the image name as I highlight below. So my question is how do I make it to where I can use a variable for the name in the code? I haven't used PHP very much so I don't know all the semantics. Any and all help is GREATLY appreciated!!!

?>
<table border="0" cellspacing="2" cellpadding="2">
<tr>
<th><font face="Arial, Helvetica, sans-serif">Photo</font></th> 
<th><font face="Arial, Helvetica, sans-serif">Brother Name</font></th>
<th><font face="Arial, Helvetica, sans-serif">Major</font></th>
<th><font face="Arial, Helvetica, sans-serif">Phone Number</font></th>
<th><font face="Arial, Helvetica, sans-serif">E-mail Address</font></th>
<th><font face="Arial, Helvetica, sans-serif">Home Town</font></th>
<th><font face="Arial, Helvetica, sans-serif">Alpha Number</font></th>
</tr>

<?
$i=0;
while ($i < $num) {
$last=mysql_result($result,$i,"Last_Name");
$first=mysql_result($result,$i,"First_Name");
$major=mysql_result($result,$i,"Major");
$phone=mysql_result($result,$i,"Phone_Number");
$email=mysql_result($result,$i,"Email_Address");
$town=mysql_result($result,$i,"Home_City");
$state=mysql_result($result,$i,"Home_State");
$alpha=mysql_result($result,$i,"Alpha_Number"); 
$photo=mysql_result($result,$i,"photo_name");
?>

<tr>
-This works when instead of $photo_name I have a hard coded value such as bros/none.jpg
<td><img src=$photo_name width="30" height="30"></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo "$last, $first"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo "$major"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo "$phone"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo "$email"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo "$town, $state"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo "$alpha"; ?></font></td>
</tr>

<?

++$i;
} 
echo "</table>";
<td><img src="<?php echo $photo_name; ?>"  width="30" height="30"></td>

Like that !

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.