预处理语句
$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);