Hello everyone,
I have a question regarding displaying images in a results row. Currently I am uploading an image path to the database and saving the image into a directory through a form. I can successfully return a row of data, however I am aiming to have the image associated with the record preceeding the data in the row. Like this
image | name | address | etc. | ect
image | name | address | etc. | ect
image | name | address | etc. | ect
well you get the idea...
I am able to return the rows fine, but I just don't know the correct coding to pull the image. Heres how I have my row display set up
<?
$query = "select * from bldgs left join forlease on bldgs.bldg_id = forlease.bldg_id ";
//then call the query and display it
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
$numofrows = mysql_num_rows($result);
echo "<TABLE BORDER=\"0\">\n";
echo "<TR bgcolor=\"#E9F0F3\"><TD>Name</TD></TR>\n";
for($i = 0; $i < $numofrows; $i++) {
$row = mysql_fetch_array($result); //get a row from our result set
if($i % 2) { //this means if there is a remainder
echo "<TR bgcolor=\"#F0F0F0\">\n";
} else { //if there isn't a remainder we will do the else
echo "<TR bgcolor=\"white\">\n";
}
echo '<TD><img src='.$row["images"].'</img></TD><TD>'.$row['address'].'</TD><TD>'.$row['rent'].'</TD><TD><a href="properties/propview.php?bldg_id='.$row['bldg_id'].'">View</a></TD>';
echo "</TR>\n";
}
//now let's close the table and be done with it
echo "</TABLE>\n";
?>
so as you can see, i use $row['whatever'] to pull the data. I try using img src and the row that leads to the picture and no dice. Just get a happy red x. The table field that stores the image path is called "images". The actual path is "../../usrfiles/properties/".
Any suggestions oh great php coders? :p