废话不多说, 直接看代码:
<?php $dbh = new PDO('mysql:host=localhost;dbname=test', "test"); $query = <<<query INSERT INTO `user` (`username`, `password`) VALUES (:username, :password); QUERY; $statement = $dbh->prepare($query); $bind_params = array(':username' => "laruence", ':password' => "weibo"); foreach( $bind_params as $key => $value ){ $statement->bindParam($key, $value); } $statement->execute();
请问, 最终执行的SQL语句是什么, 上面的代码是否有什么问题?
with 80 Comments