Prepared statement help, Number of variables doesn't match number of parameters in prepared statement

Posted by Sam Gabriel on Stack Overflow See other posts from Stack Overflow or by Sam Gabriel
Published on 2011-01-08T08:37:14Z Indexed on 2011/01/08 8:54 UTC
Read the original article Hit count: 425

Filed under:
|

I'm getting this error : Number of variables doesn't match number of parameters in prepared statement every time I run this code:

$dbh = new mysqli("localhost", "***", "***", "pics");
    $stmt = $dbh->prepare("INSERT INTO comments (username, picture, comment) VALUES (?, ?, ?)");
   $stmt->bind_Param('s', $username);
   $stmt->bind_Param('d', $picture);
   $stmt->bind_Param('s', $comment);

   $username=$_SESSION['username'];
   $picture=$_GET['id'];
   $comment=$_POST['comment'];
   $stmt->execute();

What's the problem?

© Stack Overflow or respective owner

Related posts about php

Related posts about prepared-statement