Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $_dbhost = "localhost";
- $_dbname = "serveris";
- $_dbuser = "root";
- $_dbpw = "";
- class mysqlfunctions {
- var
- $isConnected = false,
- $ConnectionError = false,
- $pdo = null
- ;
- public function __construct ( $_dbhost , $_dbname , $_dbuser , $_dbpw )
- {
- try
- {
- $pdo = new PDO('mysql:host=localhost';dbname=tavo db name';charset=utf8', 'root', 'pass');
- }
- catch (PDOExeption $e) {
- exit ('Klaida.');
- }
- }
- public function proQuery ( $query , $value = null)
- {
- if ( !$value )
- $result = $this->PDO->query ( $query ) ;
- else
- $result = $this->PDO->query ( $query , $value ) ;
- try {
- return $result;
- }
- catch ( PDOException $ex ){
- return $ex;
- }
- }
- }
- $pdo = new mysqlfunctions ( $_dbhost , $_dbname , $_dbuser , $_dbpw )
- ?>
Advertisement
Add Comment
Please, Sign In to add comment