Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class MySQL {
- private $_link = null;
- private $_host;
- private $_user;
- private $_password;
- private $_bdd;
- /* Constructeur */
- function mysql($a_host, $a_user, $a_pass, $a_bdd) {
- $this->_host = $a_host;
- $this->_user = $a_user;
- $this->_password = $a_pass;
- $this->_bdd = $a_bdd;
- }
- public function getLink() {
- return $this->_link;
- }
- function sql_connect() {
- $this->_link = new PDO('mysql:host=' . $this->_host . ';dbname=' . $this->_bdd, $this->_user, $this->_password);
- $this->_link->query("SET NAMES 'utf8'");
- }
- public function sql_close() {
- $this->_link = null;
- }
- public function sql_query($a_query) {
- return $this->_link->query($a_query);
- }
- public function sql_fetch_all($aStmt) {
- return $aStmt->fetchAll(PDO::FETCH_ASSOC);
- }
- public function sql_fetch($aStmt) {
- return $aStmt->fetch(PDO::FETCH_ASSOC);
- }
- public function sql_quote($aQuote) {
- return $this->_link->quote($aQuote);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement