I have created a simple mySQL database, and I am trying to insert some test data into it using PHP. When I ran the method on Firefox I got the following message, and I can not resolve this problem:
Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[HY093]: Invalid parameter number:
My method to insert sample into my datebase is:
public function confirmInsert(){
$admin="admin";
$pass="12345v";
$mail="[email protected]";
$insertSQL = "INSERT INTO 'users' ('user_name', 'user_pass, 'user_email')
VALUES (
:admin,
:pass,
:mail)";
try {
$stmt = $this->db->prepare($insertSQL);
$stmt ->bindParam(':user_name',$admin, PDO::PARAM_STR);
$stmt ->bindParam(':user_pass', $pass, PDO::PARAM_STR);
$stmt->bindParam(':user_email', $mail,PDO::PARAM_STR);
$stmt->execute();
$stmt->closeCursor();
return TRUE;
} catch (Exception $e) {
$e -> getMessage();
}
}
I am running on //localhost, and using apache 2.2 and php 5.2.17. Thanks!!
'user_pass
– icktoofay Jul 11 '11 at 0:52