Like system in mysql

How can add like system in my sql database

do you need query ?

if yes then

UPDATE your_table_name SET count = count + 1 WHERE id =$id

count = column name where you would store views
id = unique id of that row

1 Like

how can get excual id number

please give me an example aia if you have possible.

why are you talking like dumb?

if you have used mysql as a database they you should make one id column with AI enabled

i means how to write query for this video views increase.

I gave you a query if you don’t know about MySQL then why you have used MySQL?

you have to pass id from app with GET or POST method to your script.

get data from my sql

  1. Just get the likes count of every post from MySQL and +1 in the post likes which wants to increase likes.

  2. One more way create other tables with columns id, liked_by, post_id, date and when some click on like store their values and when other time that guy goes to post check in the data user already liked or not and to show likes count just get post_id columns from the table and filter the current post id and then store the current post positions and use the length of the list to show count.

1 Like


You need to study Relational Database and SQL commands

Hi @Rogerio_Rios Welcome to Niotron :blush:

1 Like