我正在尝试使用 pdo 上的准备语句插入值,但我遇到了这个错误
警告:PDOStatement::execute() [pdostatement.execute]: SQLSTATE[HY093]: Invalid parameter number: no parameters are bound in C:\wamp\www\chat\insert.php 第 23 行
$db = new PDO($dns, $user, $pass);
$sql = "INSERT INTO `conversations_t` (`fk_crname_c`, `fk_username_c`, `message_c`) VALUES (?, ?, ?)";
$sq_stat = $db->prepare($sql);
// bind column to variable for display
$sq_stat->bindColumn(1, $chatname);
$sq_stat->bindColumn(2,$username);
$sq_stat->bindColumn(3, $message);
$count=$sq_stat->execute();