Yes, I am totally a noob in sql. I am trying to write a small program that will take the photo attachments in a forum and make them look like an album.
I can read the database tables, and even get it to list everyone and all the photos. That is the problem. I want it to say read member #2 only and show only that members photos.
When I say if ($member > "0") it will list all the members number just fine. (i.e. member #2 shows above his photo. Member #245 shows above his photo.)
But if I say if ($member = "2") to try and get it to list ONLY member #2, it shows everyones photo but the member #2 shows above photos not even his.
Quote:
<?
$username="DBUSERNAME";
$password="DBPASS";
$database="DBNAME";
$x=date("j");
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM ibf_attachments";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
echo "<b><center>Database Output</center></b><br><br>";
$i=0;
while ($i < $num) {
$member=mysql_result($result,$i,"attach_member_id" );
if ($member > "0")
{
$isimage=mysql_result($result,$i,"attach_is_image" );
$imagedate=mysql_result($result,$i,"attach_date");
$imagesize=mysql_result($result,$i,"attach_filesiz e");
$imagewidth=mysql_result($result,$i,"attach_img_wi dth");
$imageheight=mysql_result($result,$i,"attach_img_h eight");
$imagelocation=mysql_result($result,$i,"attach_loc ation");
$imagethumblocation=mysql_result($result,$i,"attac h_thumb_location");
$attachfile=mysql_result($result,$i,"attach_file") ;
$str_2 = "http://www.WEBSITE.com/forum/uploads/$imagelocation";
$str_3 = "http://www.WEBSITE.com/forum/uploads/$imagethumblocation";
if ($isimage ="1")
{
echo "<b>$member $isimage</b><br>Image Size: $imagesize<br> Image Width: $imagewidth<br> Image Height: $imageheight<br>$attachfile<br><a href=$str_2 target='blank'><img src='$str_3' alt='the image' /></a> <br>";
}
}
?>
<?PHP
$i++;
}
?>
|