2011-01-08 87 views
2

我收到此錯誤:變量數量與準備語句中的參數數量不匹配 每次運行此代碼時:準備語句幫助,變量數量不匹配準備語句中的參數數量

$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(); 

什麼問題?

回答

2

嘗試把所有的參數到一個bindParam電話:

$stmt->bind_Param('sds', $username, $picture, $comment); 
+0

讓我建議刪除編到您的文章 – 2011-01-08 08:59:05

相關問題