note 120267 added to ref.pdo-mysql
| From: | proyecto2016 | Date: | Fri, 02 Dec 2016 22:48:45 +0000 |
| Subject: | note 120267 added to ref.pdo-mysql | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-207962@lists.php.net to get a copy of this message | ||
A way to doing a PDORepository
<?php
abstract class PDORepository{
const USERNAME="root";
const PASSWORD="";
const HOST="localhost";
const DB="parcial";
private function getConnection(){
$username = self::USERNAME;
$password = self::PASSWORD;
$host = self::HOST;
$db = self::DB;
$connection = new PDO("mysql:dbname=$db;host=$host", $username, $password);
return $connection;
}
protected function queryList($sql, $args){
$connection = $this->getConnection();
$stmt = $connection->prepare($sql);
$stmt->execute($args);
return $stmt;
}
}
?>
----
Server IP: 72.52.91.14
Probable Submitter: 190.191.109.13
----
Manual Page -- http://php.net/manual/en/ref.pdo-mysql.php
Edit -- https://master.php.net/note/edit/120267
Del: integrated -- https://master.php.net/note/delete/120267/integrated
Del: useless -- https://master.php.net/note/delete/120267/useless
Del: bad code -- https://master.php.net/note/delete/120267/bad+code
Del: spam -- https://master.php.net/note/delete/120267/spam
Del: non-english -- https://master.php.net/note/delete/120267/non-english
Del: in docs -- https://master.php.net/note/delete/120267/in+docs
Del: other reasons-- https://master.php.net/note/delete/120267
Reject -- https://master.php.net/note/reject/120267
Search -- https://master.php.net/manage/user-notes.php