table display problem....
Posted: Wed Nov 08, 2006 10:36 pm
I am still having trouble with this script. I want my images to be displayed in a table with 3 columns and I want the file comment/description to be displayed under each photo. I have tried a bunch of different things but I still can't figure this out.
Code: Select all
$sql = "SELECT * FROM `signup` WHERE id LIKE '%".$id."%' LIMIT 1";
$result = mysql_query($sql,$db);
while ($newArray = mysql_fetch_array($result))
{
$id = $newArray['id'];
if (is_dir("/reunion_photos/$id")) {
$dirname = "/reunion_photos/$id";
$dh = opendir($dirname) or die("<i>You have not added any pictures</i>");
while (false !== ($file = readdir($dh))) {
if ($file != "." && $file != "..") {
$image = "$dirname/$file";
$size = getimagesize("$image");
$height = $size[1];
$width = $size[0];
if ($height > 150)
{
$height = 150;
$percent = ($size[1] / $height);
$width = ($size[0] / $percent);
}
else if ($width > 150)
{
$width = 150;
$percent = ($size[0] / $width);
$height = ($size[1] / $percent);
}
$sql2 = "SELECT * FROM `reunion_photos` WHERE id LIKE '%".$id."%'";
$result2 = mysql_query($sql2, $db) or die(mysql_error());
while ($info = mysql_fetch_array($result2)) {
$file_comment = $info['file_comment'];
for($x=1; $x<=1; $x++)
{
echo "<td align=\"center\"><img src=\"$image\" height=\"$height\" width=\"$width\"><br><br>
<b>$file_comment</b>
</td>";
if($x % 3 == 0)
{
echo "</tr>
<tr>";
}
$x++;
}
}
}
}
closedir($dh);