[英]fetch data based on another table
我有一個表作為用戶和表作為朋友列表的斑馬。 我不想獲取連接到特定用戶的所有朋友的詳細信息
這是我正在使用的代碼。 但它不起作用。
$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>
請幫忙
您可以嘗試更改此代碼段嗎
(Select zebra_id From zebra Where user_id='$uid');";
到
(Select zebra_id From zebra Where user_id='".$uid."')";
這將轉義 $uid 變量,這可能會導致問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.