Reputation: 644
I have a table as users and table as zebra for friend list. I want t fetch the details of all friends who are connected to a particular user
Here is the code i am using. But its not working.
$user_friend_pro_query= "Select * From users Where user_id IN (Select zebra_id From zebra Where user_id='$uid');";
$user_friend_pro_fetch = $conn->query($user_friend_pro_query);
while($friend_pro_rows = $user_friend_pro_fetch->fetch_assoc())
{
$friend_id=$friend_pro_rows['user_id'];
$user_avatar_thumb=$friend_pro_rows['user_avatar_thumb'];
?><li> <a href="memeber-profile.php?user_id=<?php echo $friend_id ?>"> <img src="<?php echo $user_avatar_thumb ; ?>" width="42" height="42"></a></li>
Please help
Upvotes: 1
Views: 46
Reputation: 875
Can you try to change this code segment
(Select zebra_id From zebra Where user_id='$uid');";
to
(Select zebra_id From zebra Where user_id='".$uid."')";
This will escape the $uid variable, which might cause a problem.
Upvotes: 1