-
Notifications
You must be signed in to change notification settings - Fork 0
/
rate.php
36 lines (31 loc) · 907 Bytes
/
rate.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
include('class.php');
$val = $ob->loggedin();
if($val == false)
{
header('location:main.php');
}
else
{
$user_id = $_SESSION['user_id'];
}
$rid = $_POST['rep_id'];
$rep_by = $_POST['rep_by'];
$rep_to = $_POST['rep_to'];
global $pdo;
$ins_query = $pdo->prepare("insert into rate(reply_id,rate_by,rate_to) values(?,?,?)");
$ins_query->bindParam(1,$rid);
$ins_query->bindParam(2,$rep_by);
$ins_query->bindParam(3,$rep_to);
$ins_query->execute();
$sel_query = $pdo->prepare("select rating from reply where reply_id=?");
$sel_query->bindParam(1,$rid);
$sel_query->execute();
$raw_data = $sel_query->fetch(PDO::FETCH_OBJ);
$c =$raw_data->rating;
$c=$c+1;
$update_query = $pdo->prepare("update reply set rating = ? where reply_id = ?");
$update_query->bindParam(1,$c);
$update_query->bindParam(2,$rid);
$update_query->execute();
?>