Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once 'kapcsolat.php';
- /*
- if(isset($_GET['newsid'], $_GET['userid'])){
- $newsid=$_GET['newsid'];
- $userid=$_GET['userid'];
- $check = $db->prepare("SELECT `id`, `userid` FROM `likeok` WHERE `id`=? and `userid`=?");
- $check->bind_param('si', $newsid, $userid);
- $check->execute();
- $check->bind_result($id, $userid);
- while($check->fetch()){
- echo $id.' '.$userid.'<br />';
- }
- echo 'hello kitty';
- }
- */
- if(isset($_GET['news'], $_GET['user'])){
- $newsid = $_GET['news'];
- $userid = $_GET['user'];
- $check = $db->prepare("SELECT `id`, `userid`, `likeoltad`, `like` FROM `likeok` WHERE `id`=? and `userid`=?");
- $check->bind_param('si', $newsid, $userid);
- $check->execute();
- $check->bind_result($id, $userid, $likeoltad, $like);
- while($check->fetch()){
- echo 'id: '.$id.' userid: '.$userid.' likeoltad: '.$likeoltad.' LIKE: '.$like.'<br/>';
- }
- if ($likeoltad=='0'){
- $likeoltad++;
- $like++;
- }else{
- $likeoltad--;
- $like--;
- }
- if ($db->query("UPDATE `likeok` SET `likeoltad`='$likeoltad', `like`='$like' WHERE `id` = '$newsid'")) {
- echo $db->affected_rows;
- }
- }
- header('Location: ./like.php');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement