<?php
header("content-type:text/html;charset=utf-8");
$dbms = "mysql";
$dbhost = "localhost";
$dbuser = "root" ;
$dbpwd = "";
$dbname = "student";
$dsn = "$dbms:host=$dbhost;$dbname";
try{
$pdo = new PDO($dsn,$dbuser,$ dbpwd) susan' ,'Male','23 years old','Kindergarten','Class 1',now())";
$row = $pdo->exec($sql);
echo "Influenced".$ row ."OK";
}catch(PDOException $e){
die("Ein Fehler ist aufgetreten:".$e->getMessage());
}
?>
//
??
cre_time datetime NULL
mod_time datetime NULL
。。。。。
粗心了,$dsn = "$dbms:host=$dbhost;$dbname"; 這里錯了
應(yīng)該是$dsn = "$dbms:host=$dbhost;dbname = $dbname";? 少了dbname=
執(zhí)行結(jié)果顯示什么? 沒信息? 還是報有錯誤?