<?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"; 这里错了
应该是$dsn = "$dbms:host=$dbhost;dbname = $dbname"; 少了dbname=
执行结果显示什么? 没信息? 还是报有错误?