Jump to content

displaying image from folder


teknospr

Recommended Posts

Good day:

 

Im trying to display an image from a folder and the image name is retrieved by a query. The query is getting the image name all right but the image is not displaying. This is the code im using for the image display

 

<?php
$aid = 1;
  $connection = mysql_connect("localhost",
        "username",
        "password");

    mysql_select_db("articles", $connection); 
$query="SELECT imagename, description FROM articles_description WHERE id='$aid'";
$result=mysql_query($query);

$num=mysql_numrows($result);


mysql_close();
?>
<table width ="1000" border="1" cellspacing="2" cellpadding="2">



</tr>

<?php
$j=0;
while ($j < $num) {

$f8=mysql_result($result,$i,"description");
$f9=mysql_result($result,$i,"imagename")
?>

<tr>
<td valign="top"> <img src="images/'.$f9.'; ?>" alt="" name="picture" width="100" height="100" border="1" /></td> 
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f8; ?></font></td>

</tr>
<tr>
</tr>

<?php
$j++;
}
?>

 

Any help will be appreciated

 

Link to comment
https://forums.phpfreaks.com/topic/229776-displaying-image-from-folder/
Share on other sites

By echoing the variable from within php instead of using it as a string literal in the markup. You know how to go into and out of PHP and how to echo a variable, right?

 

<img src="images/" <?php echo $f9; ?>" alt="" name="picture" width="100" height="100" border="1" />

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.