how do you design database fields like youtube pages that show whether you have pressed like or dislike? And go to the database to judge when the user arrives at the page?
whether the design idea is like this
Post table
id picroute likeusers dislikeusers
1 img/0001.jpeg {1, 3, 4, 6, 11, 44, 233} {2, 5, 8, 15, 6, 7, 7, 88}
put it in a field to click like"s userid
Can you tell me what syntax does the separator-like method use to fill in the end of the field one by one?is it possible to read the reality in the database processing syntax, for example, whether likeusers has 11 userid without having to take the entire likerusers field out of the database and then use something like sieve ringworm for php or javascript processing?
in addition, can I use sql syntax to add and delete a userid that is not the whole field and delete it after the whole field is removed? use the update to put the field back in the whole field?
some people may want to say why I don"t consider the whole table, but I think it"s too much table for an youtube article with a like dislike to create a table to accommodate the userid that has been clicked on like.
so the effect you want to achieve is
there are multiple pictures on one page, for example, nine pictures
each picture has a like and dislike button and a display number
when the user enters this page, the database takes out the connection src of each picture, and then compares the user"s userid to whether there is the userid in the userlike array of a single id in each post table
. if likeusers has the userid, it shows that like cannot be clicked, but dislike can click
and vice versa
and then if both fields do not have userid, then both like and dislike show selectable states
do not know that such a design concept is OK? Or is there any way to achieve it?
I want to know and write it out with laravel, but I still don"t know what sql syntax can be used
to write userid to the same field or to check whether there is the userid in the same field and how to delete and add a userid? individually