Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Like / Dislike system

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #187472
    Anonymous
    Inactive

    Can someone point me to a good PHP tutorial that shows me how to build a like/dislike system that uses AJAX, and remembers the user rating? I cant seem to find even a decent one that does this.

    #187477
    __
    Participant

    I cant seem to find even a decent one that does this.

    That’s probably because it’s not a “one-tutorial” project. First it depends very heavily on what it is you’re liking/disliking, and how that content is identified and stored. While the basic concepts might sound “simple” —e.g., “submit a form via ajax that identifies the item liked/disliked, and the user id, and store them in the DB”— there’s a lot more to actually implementing them. I don’t want to discourage you, but the fact that you have to ask for a tutorial indicates you are probably not knowledgeable/experienced enough to take the project on.

    You might be better off dedicating your time to more study/ practice with the involved technologies. If you want to try it, though, here’s the basic idea. You need:

    1. a way to identify the item liked/disliked (e.g., a unique article ID)
    2. a way to identify the user (i.e., a user registration+login system)

    You’ll need to make:

    • a form that knows the item & user id (I also recommend using nonce tokens to authenticate the form itself)
    • JS to submit it via ajax and process the return value
    • PHP to process and validate the form submission
    • a DB to store the relationship between user→item liked
    • more PHP to retrieve that info when the content is viewed, and display the like/dislike count on the page (or whatever you want to use the info for)

    …each of these items, as you can see, is at least one tutorial in and of itself. And with projects like this, it is just as important to have an understanding of the system as a whole before starting to write code.

    If you have any specific questions, please post again.

    #187490
    Anonymous
    Inactive

    Its plain PHP, HTML, and CSS. The website is already finished, I simply need a way to rate content with like/dislike. Im storing the content in a mysql database.

    #187491
    __
    Participant

    You’ll need:
    * a way to identify the item liked/disliked (e.g., a unique article ID)
    * a way to identify the user (i.e., a user registration+login system)

    do you have those in place?

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Back End’ is closed to new topics and replies.