摘要:
tabName=$tabName; try{ $this->pdo=newPDO("mysql:host=localhost;dbname=oop","root","111111"); $this->pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); }catch(PDOException$e){ echo"数据库连接失败:".$e->getMessage(); } $this->fields=$this->g 阅读全文
摘要:
PDO方法连接数据库更加安全!【完整代码,只需要添上对应的数据库即可以运行】'SET NAMES utf8'); $pdo = new PDO($dsn,$username,$passwd,$opts_values); //2、new一个php数据对象PDO}catch(PDOException $e){ echo $e->getMessage();}// $pdo->query("SET NAMES utf8"); $sql = "select id,username,sex,addtime from user";$stmt 阅读全文