I'm having some difficulty with my mysql_fetch_assoc. Basically what I have is a user's post and i'm trying to print out a set of results that would show the user who's currently 'liking' their post (like facebook). However, there seems to be a problem that i'm not 100% sure how to fix just now and maybe you can help.
Let's say my post id is "157", in my database the post "157" has 5 'likes' and the users id that like this post are "111, 2, 1, 114 and 42".
With this code...
PHP Code:
$thispost = $_REQUEST['id'];
$grablikes = mysql_query("SELECT `user_id`, `post_id` FROM `likes` WHERE `likes`.`post_id` = '$thispost'");
$wholikes = mysql_fetch_assoc($grablikes);
echo "$wholikes[user_id]";
I get the result "111". Which is obviously not what i'm looking for. It's as if the fetch_assoc is not grabbing the other 4 results.
I'm sure there is an easy way to solve this problem, hope you have time to help!
Thanks!