display image from folder using path from database
Posted: Sat Feb 21, 2009 7:35 am
hi there, im new at this site and php
well i think i have a simple problem but i cant figure out whats wrong with my php code
i want to display an image from folder using the path that i have inserted from database.
i keep wondering whats wrong,
can someone help me out?
please!!!
tnx in advance
heres my code:
<?php
include("connect.php");
mysql_select_db("dbemail", $con);
$check = mysql_query("SELECT * FROM tblemail
WHERE username = '$_COOKIE[ID_my_site]'") or die(mysql_error());
while($row = mysql_fetch_array($check))
{
echo $row['photo'];
echo "<br>";
$dirname = "./images/thumbs/";
$images = scandir($dirname);
$ignore = Array(".", "..");
foreach($images as $curimg)
{
if(!in_array($curimg, $ignore))
{
if($row['photo'] == $dirname.$curimg)
{
echo "<img src='./images/thumbs/$curimg' /><br>\n";
}
};
}
}
?>
well i think i have a simple problem but i cant figure out whats wrong with my php code
i want to display an image from folder using the path that i have inserted from database.
i keep wondering whats wrong,
can someone help me out?
please!!!
tnx in advance
heres my code:
<?php
include("connect.php");
mysql_select_db("dbemail", $con);
$check = mysql_query("SELECT * FROM tblemail
WHERE username = '$_COOKIE[ID_my_site]'") or die(mysql_error());
while($row = mysql_fetch_array($check))
{
echo $row['photo'];
echo "<br>";
$dirname = "./images/thumbs/";
$images = scandir($dirname);
$ignore = Array(".", "..");
foreach($images as $curimg)
{
if(!in_array($curimg, $ignore))
{
if($row['photo'] == $dirname.$curimg)
{
echo "<img src='./images/thumbs/$curimg' /><br>\n";
}
};
}
}
?>