Like and Unlike System in PHP and MYSQLi


Hey, What’s up everybody I am back with another new post on like and unlike system in PHP,MySQLi, and w3.css.

As you guys know that nowadays every social network or a blog or any kind of community website uses like and unlike system so that one can like one’s shared posts and express their feeling on their thoughts and liking the post is the way we can tell them that we liked the post or not.

Demo Download Subscribe on Youtube

So here it is guys, today I going to show you how to make a like and unlike system in PHP and MySQLi (Yes we are using MySQLi(Procedural) and not simple MySQL for better security.) and the frontend is designed using the w3.css Framework

If you guys are not aware of w3.css, you can check it out here at –

And you can also check out my projects in which I have used w3.css as an HTML framework here –

and much more…

So, guys, let’s get started.

Features –

  • A user can like the post only one time.
  • Like link changes to unlike after liking so that no one can like again and again. (Basic)
  • Login Protection.
  • Mysqli used instead of MySql for extra security.
  • Likes Count.

The codes can be easily integrated in your website, just few changes you have to make in Sql queries according to your database and edit the db.php file with your database credentials.

Database Design –

So here is the database design for this project.

The Blue Words indicated the Foreign key coming from another table.

And that’s it guys its a pretty basic system in PHP and MySQLi


Ta da!