Code Monkey home page Code Monkey logo

like_dislike_system's Introduction

This system works exactly like the Like/Dislike system YouTube implements for its videos. On YouTube, the buttons are placed on videos. But, we will be using simple posts where users can click on their associated like and dislike buttons.

We will be using:

==>> Ajax of JQuery to communicate with the server without reloading the page. ==>> JQuery to select elements and write values and styles and attributes on the DOM. ==>> PHP to do the backend logic like receiving click actions and performing the database calls ==>> MySQL as the database

For the database, create 'posts' table using the sql query below:

CREATE TABLE posts ( id int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, text text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

For rating_info:

CREATE TABLE rating_info ( user_id int(11) NOT NULL, post_id int(11) NOT NULL, rating_action varchar(30) NOT NULL, CONSTRAINT UC_rating_info UNIQUE (user_id, post_id) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

You can populate the posts table with a few posts that we are going to be liking and disliking. Run the following commands to populate the table:

INSERT INTO posts (id, text) VALUES (1, 'This is the first post'), (2, 'This is the second piece of text'), (3, 'This is the third post'), (4, 'This is the fourth piece of text');

Note: Make sure that on the rating_info table, the user_id and post_id fields are UNIQUE. Which means that there cannot be two records of a particular user and a particular post on the table.

like_dislike_system's People

Contributors

joy-joel avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.