sql >> Database >  >> RDS >> Mysql

weergavelijst van vriendgebruiker toont niet alle gebruikers

je afbeeldingen en div's die de records van vrienden bevatten, worden vervangen door de volgende record, zodat de laatste record van je vrienden wordt weergegeven.probeer dit je misschien te helpen

$friendList = "";
$friendListTitle="";
if($friend_array!="")
 {
   $friendArray = explode(",", $friend_array);

   $friendArray = array_slice($friendArray,0,6);
   $friendCount = count($friendArray); 
   var_dump($friendCount);
   $friendListTitle = '<div class="title"> '.$username.'\'s Friends('.$friendCount.')</div>';
    //iterating to retrieve what it's needed as values
    $i=0;
    $friendList ='<div  style="background-color:"#CCC"; >'; 
    foreach($friendArray as $frndlist => $value)
    {
        $i++;
        $check_pic = 'members/'.$value.'/image01.jpg';
        if(file_exists($check_pic))
        {
            //storing each friend images separately
            $frnd_pic[$i] = '<a href="profile.php?user_id='.$value.'"><img src = "'.$check_pic.'" width = "52px" border = "1"/></a>';
        }
        else
        {
            $frnd_pic[$i] = '<a href="profile.php?user_id='.$value.'"><img src = "members/0/image01.jpg" width = "52px" border = "1"/></a>&nbsp;';
        }
        $sqlName = mysql_query("SELECT first_name, last_name FROM members WHERE user_id= '$value'LIMIT 1") or die(mysql_error());
        if ($row = mysql_fetch_array($sqlName, MYSQL_ASSOC))
        {
            $fname = $row['first_name'];
            $lname = $row['last_name'];
            $friendList .= '<div title="'.$fname.' '.$lname.'">'.$frnd_pic[$i].'</div>';
        }
    }
    $friendList.='</div>';

}




  1. Trage subquery in MySQL

  2. UNIX_TIMESTAMP() Voorbeelden – MySQL

  3. ORA-24408:kan geen unieke servergroepsnaam genereren

  4. Hoe druk ik alle velden voor alle tabellen in de mysql-database af?