日期:2014-05-17 浏览次数:20412 次
<?php class dUser { public function newpdo() { global $dbinfo; $dsn = "mysql:host={$dbinfo['host']};port={$dbinfo['port']};dbname={$dbinfo['dbname']}"; $pdo = new PDO($dsn, $dbinfo['user'], $dbinfo['pwd'], array(PDO::ATTR_PERSISTENT => true)); return $pdo; } public function getUserByName(&$info, $name) { $dbpdo = $this->newpdo(); $sql = "SELECT * FROM `usermember` WHERE `user`=?"; $st = $dbpdo->prepare('SELECT * FROM `usermember` WHERE `user`=?'); $bRet = $st->execute(array($name)); $info = $st->fetch(PDO::FETCH_ASSOC); return $bRet; } } ?>