title: PHP commenting system
body: <p>am trying to build a commenting system with PHP and Mysql. I want to link one post with many comments. So I have a posts table and a comments table. The comments table has a foreign key of post_id which is similar to the posts table id column(which is the primary key in posts table). Once the admin adds a post, the post_id column is inserted with the id of that post. This means that when adding comments, someone has to update the comments table which in my case, it doesn't. Here is the update query.</p>
  
  <pre><code>if(isset($_POST['cmt-btn'])){
  if(!empty($_GET['id'])){
      $current_id = $_GET['myid'];
      echo $current_id;
      $comment = filter_var($_POST['comment'], FILTER_SANITIZE_STRING);
      $author = filter_var($_POST['author_name'], FILTER_SANITIZE_STRING);
      $post_id = $current_id;
      $time = now();  
      $sql = "UPDATE comments SET comments = '$comment', author = '$author', timeposted = '$time' WHERE post_id = '$current_id'";
      $result = $connection-&gt;query($sql);
  }
  </code></pre>
  
  <p>The comment table simply fills the empty columns with NULL.
  I don't seem to trace where the problem is. </p>