Like system

Hello

I am working on a like system for my blog.

So far Ive managed to display all the users that have liked a certain post.
Let’s say 5 people have liked my post.

This is how it will be displayed
billy, bob, jacob, sarah, tanya have liked this post.

How can I get it to display something like this instead:
Billy, bob and 3 others have liked this post.

How are you displaying the 5 users?

Hi, how would I go about displaying the first two users?

  1. Get the number of selected rows with mysql_num_rows().
  2. Subtract 2 from that number.
  3. Display only the first two users that liked the post, and then add the ‘and n others’ part (if the result from #2 is > 0)