-
Notifications
You must be signed in to change notification settings - Fork 0
/
post_comment.php
50 lines (42 loc) · 1.6 KB
/
post_comment.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
ini_set("display_errors","1");
include 'inc/includeAllFiles.inc.php';
date_default_timezone_set("Asia/Kathmandu");
$post_id = $_GET['post_id'];
//echo $post_id;
$comment_body = $_GET['comment_body'];
$date_posted = date('yy-m-d h:i:sa');
$comment_upvote = 0;
$comment_downvote = 0;
$comment_respect = 0;
$comment_reply = 0;
$upvoters_id = 0;
$downvoters_id = 0;
$respecters_id = 0;
$repliers_id = 0;
$commenters_id = $_GET['my_id'];
//echo "$post_id $comment_body $commenters_id";
// $dbconnect2 = new databaseConnect("members","localhost","bharat","ProGrammEr99");
// $conn = $dbconnect2 -> connectDb();
$commentInsertquery = "INSERT INTO `post_comments` (`comment_body`, `post_id`, `commenters_id`,
`upvotes`, `downvotes`, `respects`, `reply`, `upvoters_id`, `downvoters_id`,
`respecters_id`, `repliers_id`, `date_posted`)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
$commentInsertquerystmt = $conn -> stmt_init();
if($commentInsertquerystmt -> prepare($commentInsertquery))
{
$commentInsertquerystmt -> bind_param('siiiiiiiiiis',$comment_body,$post_id, $commenters_id
, $comment_upvote, $comment_downvote, $comment_respect
, $comment_reply, $upvoters_id, $downvoters_id, $respecters_id, $repliers_id
, $date_posted);
$commentInsertquerystmt -> execute();
$commentInsertquerystmt-> free_result();
echo "success";
}
else
{
echo "error";
$error = $commentInsertquerystmt -> error;
echo $error;
}
?>