Implementing a Like Button
So I'm trying to implement a like button for images on my site. But I'm having a little trouble figuring out how it goes.
So far, I have this on the SQLI side of things :
Where `id` is the id of the like,
CREATE TABLE if not exists `likes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`liked_image_id` varchar(300) NOT NULL,
`liker_username` varchar(50) NOT NULL,
`liked_unliked` enum('0','1') NOT NULL, DEFAULT '0'
PRIMARY KEY (`id`)
`liked_image_id` is the id of the image being liked,
`liker_username` is the username of the user clicking the like button,
`liked_unliked` is whether or not that user has liked the image (1 for liked, 0 for unliked [to make sure users only vote once]).
So...is what I have so far even correct? Like I said, I'm trying to get it so that users can click the like button and like image, but only once. Any help is appreciated. Thanks
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)