<?php //造PDO对象
$pdo = new PDO("mysql:dbname=mydb;host=localhost","root","123"); //写SQL语句
$sql = "insert into Info values(:code,:name,:sex,:nation,:birthday)"; //准备SQL语句
$st = $pdo->prepare($sql); /*//绑定参数
$st->bindParam("c",$code,PDO::PARAM_STR);
$st->bindParam("n",$name,PDO::PARAM_STR);
$st->bindParam("s",$sex,PDO::PARAM_STR);
$st->bindParam("na",$nation,PDO::PARAM_STR);
$st->bindParam("b",$birthday,PDO::PARAM_STR); //参数赋值
$code = "p180";
$name = "会啊";
$sex = true;
$nation = "n002";
$birthday = "1988-2-3"; //执行
$st->execute();*/ $st->execute($_POST); ?>