First bit of code is my current method to build a list of 20 user pictures
<?PHP
//this methos has 21 queries
//makes DB connection and includes all needed functions
require_once "../config/functions.inc.php";
//show 20 users who are online
$sql = 'SELECT userid FROM friend_online WHERE g="' .$g. '" ORDER BY userid ASC LIMIT 0,20';
$result= executequery($sql);
//loop through 20 results from above
while($line=mysql_fetch_array($result)){
//show user pictures
//this function makes new query to get picture URL
show_user_photo($line['userid'],$photo_type='small',$user_name='yes');
}
?>
Below is the new method I am working on but im stuck and need soem help please
<?PHP
//this methos would have only 2 queries i think
require_once "../config/functions.inc.php";
//show 20 users who are online
$sql = 'SELECT userid FROM friend_online WHERE g="' .$g. '" ORDER BY userid ASC LIMIT 0,20';
$result= executequery($sql);
//instead of looping through and making 20 more queries to get pictures let do it in 1 query
//the numbers at the end should be from the first query above
$sql = 'SELECT * FROM friend_reg_user WHERE auto_id in(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)';
$result= executequery($sql);
//do a while statement or what here to show the picture urls in there own little table?
?>