Bicas

Untitled

Dec 20th, 2014
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.08 KB | None | 0 0
  1. <?php
  2.  
  3.     $_dbhost = "localhost";
  4.     $_dbname = "serveris";
  5.     $_dbuser = "root";
  6.     $_dbpw = "";
  7.  
  8.     class mysqlfunctions {
  9.         var
  10.             $isConnected = false,
  11.             $ConnectionError = false,
  12.             $pdo = null
  13.         ;
  14.         public function __construct ( $_dbhost , $_dbname , $_dbuser , $_dbpw )
  15.         {
  16.             try
  17.             {
  18.                 $pdo = new PDO('mysql:host=localhost';dbname=tavo db name';charset=utf8', 'root', 'pass');
  19.             }
  20.                 catch (PDOExeption $e) {
  21.                 exit ('Klaida.');
  22.             }
  23.         }
  24.         public function proQuery ( $query , $value = null)
  25.         {
  26.             if ( !$value )
  27.                 $result = $this->PDO->query ( $query ) ;
  28.             else
  29.                 $result = $this->PDO->query ( $query , $value ) ;
  30.             try {
  31.                 return $result;
  32.             }
  33.             catch ( PDOException $ex ){
  34.                 return $ex;
  35.             }
  36.         }
  37.     }
  38.     $pdo = new mysqlfunctions ( $_dbhost , $_dbname , $_dbuser , $_dbpw )
  39. ?>
Advertisement
Add Comment
Please, Sign In to add comment