note 121193 added to pdo.construct

From: Date: Tue, 06 Jun 2017 20:39:45 +0000
Subject: note 121193 added to pdo.construct
Groups: php.notes 
Request: Send a blank email to php-notes+get-209126@lists.php.net to get a copy of this message
rlm. <?php require_once __DIR__ . '/../app/conf/config.php'; //session_start(); class ConexionBd { private $con; public function __construct() { $params = (new Configuration())->getDbParams(); //$uid = file_get_contents("C:\AppData\uid.txt"); //$pwd = file_get_contents("C:\AppData\pwd.txt"); try { $this->con = new PDO("sqlsrv:server={$params['server']},{$params['port']};Database={$params['database']}", //$uid, $pwd); $params['user'], $params['pass']); $this->con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); }catch(PDOException $ex) { die("Error de conexión".$ex->getMessage()); } } public function getConexion() { return $this->con; } } __ <?php class configuration { private $dbParams = array("driver"=>"pdo_sqlsrv", "server"=>"(local)", "port"=>"1433", "database"=>"CadenaTiendas", "user"=>null, "pass"=>null, "charset"=>"utf-8"); public function __construct() { } public function getDbParams() { return $this->dbParams; } } ---- Server IP: 72.52.91.14 Probable Submitter: 85.219.9.59 ---- Manual Page -- http://php.net/manual/en/pdo.construct.php Edit -- https://master.php.net/note/edit/121193 Del: integrated -- https://master.php.net/note/delete/121193/integrated Del: useless -- https://master.php.net/note/delete/121193/useless Del: bad code -- https://master.php.net/note/delete/121193/bad+code Del: spam -- https://master.php.net/note/delete/121193/spam Del: non-english -- https://master.php.net/note/delete/121193/non-english Del: in docs -- https://master.php.net/note/delete/121193/in+docs Del: other reasons-- https://master.php.net/note/delete/121193 Reject -- https://master.php.net/note/reject/121193 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#209126) next »