Hi I am using some code to get a picture out of the database. It does this fine. But I want it to display the last 6 pictures uploaded, at the mo it only display 1. Here is the code - [B<? $query="select * from members,photos where members.username=photos.username and active=1 and approved='Y' ORDER BY UPLDATE ASC"; $result=mysql_query($query); while($obj=mysql_fetch_object($result)) if($obj->url=="") { $dpic="<img border=0 src='pics/$obj->filename'>"; } echo "$dpic"; ?>[/B] PHP:
You could have used the same topic. At least reply to the other thread with a link to this here, so no one wastes his time with the old code...
Try this query: $query=" select * from members, photos where members.username = photos.username and active=1 and approved='Y' GROUP BY photos.url ORDER BY UPLDATE ASC"; PHP: