title: why is this PDO insert not working?
body: <p>please help , this is not inserting into db    </p>
  
  <pre><code>$dbh = new PDO('mysql:host=localhost;dbname=blog', root, root);
  
  if($dbh){
  
  // use the connection here
  
  $stmt = $dbh-&gt;prepare("INSERT INTO comments (blog_id,dateposted,name,comment) VALUES (:blog_id,:dateposted,:name,:comment)");
  $stmt-&gt;bindParam(':blog_id', $validentry);
  $stmt-&gt;bindParam(':dateposted', NOW());
  $stmt-&gt;bindParam(':name', $_POST['name']);
  $stmt-&gt;bindParam(':comment', $_POST['comment']);
  $stmt-&gt;execute();
  
  // and now we're done; close it
  
  }else{
      echo mysql_error();
  }
  
  $dbh = null;
  //redirect after posting
  </code></pre>