執行PDO 中的預處理語句時一直不成功,想請教各路好漢指點迷津
<?php
$servername ="localhost";
$username = "root";
$password = "";
$dbname = "myDBPDO";
try{
$conn = new PDO("mysqli:host=$servernamedbdbname=$servername; ",$username,$password);
//設定PDO錯誤模式為例外
$conn->serAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//預處理SQL並綁定參數
## //預處理SQL並綁定參數
## //預處理SQL並綁定參數
$stmt= $conn->prepare("INSERT INTO MyGus 是(firstname,lastname,email) VALUES(:firstname,:lastname,:email)");
$stmt->bindParam(':firstname',$firstname );
$stmt->bindParam(':lastname',$lastname);
$stmt->bindParam(':email',$email);
email);
## //傳入參數並且執行
$firstname = "Jhon";
$lastname = "Doe";
$lastname = "Doe";
$lastname = "Doe";
$email = "jhon@example.com";
$stmt->execute();
$firstname = "Mary";
$firstname = "Mary";
# $firstname = "Mary";
# $firstname = "Mary";
## $lastname = "Moe";
$email = "mary@example.com";
$stmt->
## $firstname = "Julie";
$lastname = "Dooley";
$email = "julie@example.com";# $eample.# # $stmt->execute();
# echo "新紀錄插入成功! ";
}catch(PDOException $e){
echo "Error:<br> ". $e->getMessage();
### }############### $conn=null; ###### #### ; ;############
W2563 天前976