$sql = 'select * from `holdings` where `added` = 1 ORDER BY `likes` DESC '; $query = $conn->query($sql); $result = $query->fetch_all(); if($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['vote']) ){ if (isset($_COOKIE['voting'])) { die('you can\'t vote more than once'); # code... } $sqla = 'select `likes` from `holdings` where `ID` =\''.$_POST['vote'].'\''; $querya = $conn->query($sqla); $resulta = $querya->fetch_array()[0]; if ($querya && $resulta !== null ) { $new = $resulta + 1; $sqlu = 'update `holdings` set `likes` = \''.$new.' where `ID` = \''.$_POST['vote'].' '; $queryu = $conn->query($sqlu); if ($queryu) { # code... setcookie('voting',time(),time()+(84600*30)); echo '

تم اضافة صوتك

'; exit(); } }else{ die($conn->error); # code... } } ?>

اعلى الصور تصويتاً