已采纳回答 / EasyChen
很多 web 应用程序通过使用到数据库服务的持久连接获得好处。持久连接在脚本结束后不会被关闭,且被缓存,当另一个使用相同凭证的脚本连接请求时被重用。持久连接缓存可以避免每次脚本需要与数据库回话时建立一个新连接的开销,从而让 web 应用程序更快。
2014-11-14
setAttribute(PDO::ATTR_ERRMODE,PDO::ERRROMODE_WARNING|EXCEPTION|SLIENCE)
2014-11-14
call test()
delimiter //
create procedure test
begin
select * from user;
select * from usergroups
end
//
delimiter ;
delimiter //
create procedure test
begin
select * from user;
select * from usergroups
end
//
delimiter ;
2014-11-14
PDOSTATEMENT对象果然强大 getColumnMeta()获取列元数据信息 getCloumnCount()获取列数
2014-11-14
"select username,password from user where userid=1"
$stmt->bindColumn(1,$username);
$stmt->bindColumn(2,$password);
while($stmt->fetch(PDO::FETCH_BOUND)){
echo $username,$password;
}
$stmt->bindColumn(1,$username);
$stmt->bindColumn(2,$password);
while($stmt->fetch(PDO::FETCH_BOUND)){
echo $username,$password;
}
2014-11-14
$stmt->bindParam(':username',$username,PDO::PARAM_STR);
$username = 'rambo;
$stmt->execute();
$username = 'king;
$stmt->execute();
$username = 'rambo;
$stmt->execute();
$username = 'king;
$stmt->execute();
2014-11-14
rowCount execute(array(':username'=>$username,':password'=>$password))
2014-11-14