Good Day all,
I have an issue where I can't seem to get pictures displayed properly from a particular directory when using file_exist function.
First let me explain a little bit about what I am trying to do.
I have users upload pictures using a form, then pictures are stored under that particular users #id, for example: 89099887/whatever.jpg. The picture is not renamed, it keeps its original name.
Now each user is categorized, so for example when clicked on Miami, it will display a list of all users who are under that category. It should display the thumbnail picture and users name right under, in that order for each user. See below:
USER #1 PICTURE
USER #1 NAME
USER #2 PICTURE
USER #2 NAME
USER #3 PICTURE
USER #3 NAME
I hope you understand what I am trying to do, if you can help me I would appeciate it very much.
Right below is the code were I am trying to figure it out:
<?php
include "admin/login/db_connect.inc";
$city=$_GET['city'];
$category=$_GET['category'];
?>
<html>
<head>
<title></title>
</head>
<body bgcolor="#000000">
<body>
<font color="#FFFFFF">
<p align="center"><font face="ariel, helvetica" size="2" color="f8fa36"><?php echo $category;?> in <?php echo $city;?></font></p>
<?php
$result = mysql_query("SELECT clients_name, id FROM clients_info WHERE city='$city' AND $category='x'group by clients_name");
while ($row = mysql_fetch_array($result, MYSQL_NUM))
{
$filename="/data/11/0/77/86/729738/user/744719/htdocs/b/admin/client_pics/$row[1]/";
if (file_exists($filename))
{
$dir = "/data/11/0/77/86/729738/user/744719/htdocs/b/admin/client_pics/$row[1]/";
$dh = opendir($dir);
$files[2]='';
while (false !== ($filename = readdir($dh)))
{
$files[]=$filename;
//echo "filename: $filename : filetype: " . filetype($dir . $filename) . "\n";
}
print "<TR><TD><img src=/b/admin/client_pics/$row[1]/$files[2]></TD></TR>";
closedir($dh);
}
else {
echo "This client has no pictures";
}
print("<TR><TD><center>");
/* <img src=/phpThumb/phpThumb.php?src=/b/admin/client_pics/$row[1]/$files[2]&w=100></br> */
print ("<a href=view_profile.php?id=$row[1] target=frame3>$row[0]</a></TD></TR>");
}
mysql_free_result($result);
?>
This code is without me trying to use file_exist. This one only displays the list of users names. I need to incorporate the pic above each user name. Maybe someone will find it easier to figure it out using this file.
<?php
include "admin/login/db_connect.inc";
$city=$_GET['city'];
$category=$_GET['category'];
?>
<html>
<head>
<title></title>
</head>
<body bgcolor="#000000">
<body>
<font color="#FFFFFF">
<p align="center"><font face="ariel, helvetica" size="2" color="f8fa36"><?php echo $category;?> in <?php echo $city;?></font></p>
<?php
$result = mysql_query("SELECT clients_name, id FROM clients_info WHERE city='$city' AND $category='x'group by clients_name");
while ($row = mysql_fetch_array($result, MYSQL_NUM))
{
print ("<a href=view_profile.php?id=$row[1] target=frame3>$row[0]</a></TD></TR>");
}
mysql_free_result($result);
?>