Advertisement
Guest User

Untitled

a guest
Jan 24th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.78 KB | None | 0 0
  1. if(isset($_POST['create_comment'])) {
  2.  
  3.     $the_post_id = $_GET['p_id'];
  4.  
  5.     $comment_author = $_POST['comment_author'];
  6.     $comment_email = $_POST['comment_email'];
  7.     $comment_content = $_POST['comment_content'];
  8.    
  9.     $query = "INSERT INTO comments(comment_post_id, comment_author, comment_email, comment_content, comment_status, comment_date) ";
  10.     $query .= "VALUES({$the_post_id}, '{$comment_author}', '{$comment_email}', '{$comment_content}', 'unapproved', now())";
  11.  
  12.  
  13.     $create_comment_query = mysqli_query($connection, $query);
  14.  
  15.     confirmQuery($create_comment_query);
  16.  
  17.     $query = "UPDATE posts SET post_comment_count = post_comment_count + 1 ";
  18.     $query .= "WHERE post_id = $the_post_id ";
  19.  
  20.     $update_comment_count = mysqli_query($connection, $query);
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement