Hi, This script i have is pulling out the latest photo's upload and the users name with a link to their profile. My problem is its only displaying 1 photo - how do i get it to display say the last 6 uploaded ? <h1>SQL / PHP test platform</h1><br /><br /> <? include("config.php"); $numcomments=0; $nomember=false; $case=0; if(empty($username)) { $sql="select * from members,photos where members.username=photos.username and active=1 and approved='Y' ORDER BY UPLDATE DESC"; } else { $sql="select * from members where username='$username' and active=1"; $case=1; } $res=mysql_query($sql); if($obj=mysql_fetch_object($res)) { $username=$obj->username; $himessage="Hi I am $obj->fname $obj->lname"; $aboutme=$obj->about; } else { $nomember=true; $msg="No Pictures Exist!"; if($case==1)$msg="No member exists with that username"; } if(!$nomember) { $sql="select * from photos where username='$username' and approved='Y' order by upldate desc"; $res=mysql_query($sql); $num=0; if(mysql_num_rows($res)!=0) { $rnum=rand(0,mysql_num_rows($res)-1); } else { $nomember=true; $msg="No Pictures Exist for that username!"; } while($obj=mysql_fetch_object($res)) { if($obj->url=="") { $dpic="<img border=0 src='pics/$obj->filename'>"; } else { $dpic="<img src='$obj->url'>"; } if((empty($phid)&&($num==$rnum))||($phid==$obj->photosid)) { $photoid=$obj->photosid; $pic=$dpic; $allpics=$allpics."<b>".($num+1)."</b> "; } else { $allpics=$allpics."<a href='index.php?username=$username&phid=$obj->photosid'>".($num+1)."</a> "; } $num++; } } ?> <? print $pic;?> <br /> <a href="http://www.pictures2rate.com/index.php?cmd=20&username=<? print $username; ?>">View <? print $username; ?> Profile</a> PHP: