· 10 years ago · Sep 17, 2016, 10:32 AM
1CREATE TABLE IF NOT EXISTS `love` (
2 `id` int NOT NULL AUTO_INCREMENT,
3 `id_user` int DEFAULT '1',
4 `id_user` int DEFAULT '1',
5 `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
6 PRIMARY KEY (`id`),
7 UNIQUE KEY `user_love` (`id_user`,`id_user`)
8) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
9
10$query = "INSERT INTO `votes` (`id_user`, `id_shot`) VALUES (1, ".$id_shot.");";
11 $res = mysqli_query($db_con, $query) or die("Query failed");
12 echo $queryvote;
13 echo 'res: '.$res;
14 echo mysqli_error();
15
16SELECT * FROM `love` WHERE id_shot='12' AND id_user='1';INSERT INTO `votes` (`id_user`, `id_user`) VALUES (1, 12);res: 1