please help with code
Posted: Wed Oct 04, 2006 5:50 pm
I have the following code, it works fine except for one thing.
I am trying to query the database for clients who fit the specifications from the previous page.
To make the long story short, I need to display clients thumbnail pictures and their name under the picture. It displays the first client and clients picture but then the others do not. I believe that the problem is with file_exists function and the first "print". Any help is well appreciated.
I am trying to query the database for clients who fit the specifications from the previous page.
To make the long story short, I need to display clients thumbnail pictures and their name under the picture. It displays the first client and clients picture but then the others do not. I believe that the problem is with file_exists function and the first "print". Any help is well appreciated.
Code: Select all
<?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);
while (false !== ($filename = readdir($dh))) {
$files[]=$filename; }
} 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></TD></TR>");
print("<TR><TD><center><a href=view_profile.php?id=$row[1] target=frame3>$row[0]</a></TD></TR>");}
mysql_free_result($result);
?>[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.