?php dbh = new PDO("mysql:host=localhost; dbname=demo", "user", "pass");$dbh-setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $dbh-exec("set names 'utf8'");$sql="select * from test where name = ? and password = ?";$stmt = $dbh-prepare($sql)
<?php dbh = new PDO("mysql:host=localhost; dbname=demo", "user", "pass"); $dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $dbh->exec("set names 'utf8'"); $sql="select * from test where name = ? and password = ?"; $stmt = $dbh->prepare($sql); $exeres = $stmt->execute(array($name, $pass));