PDO prepare预处理语句

预处理语句

$dsn="mysql:host=localhost;dbname=emp";
try{
	$pdo=new PDO($dsn,'root','root');
}catch(PDOException $e){
	die('error:'.$e);
}

$sth=$pdo->prepare('select user,pass from admin where pass=?');
$sth->execute(array(111));
$rows=$sth->fetchAll();
var_dump($rows);

  

posted @ 2017-10-26 20:29  yolo_bean  阅读(187)  评论(0编辑  收藏  举报