php - fetch data based on another table -


i have table users , table zebra friend list. want t fetch details of friends connected particular user

here code using. not working.

     $user_friend_pro_query= "select * users user_id    in    (select zebra_id zebra 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

can try change code segment

(select zebra_id zebra user_id='$uid');"; 

to

(select zebra_id zebra user_id='".$uid."')"; 

this escape $uid variable, might cause problem.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -