SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: like system

  1. #1
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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.

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,412
    Mentioned
    149 Post(s)
    Tagged
    4 Thread(s)
    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)

  3. #3
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, how would I go about displaying the first two users?

  4. #4
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,412
    Mentioned
    149 Post(s)
    Tagged
    4 Thread(s)
    How are you displaying the 5 users?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •