Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MySQL_Database extends PDO {
- public function __construct($host, $user, $pass, $database) {
- $user = '';
- $pass = '';
- $host = '';
- $db = '';
- try {
- parent::__construct("mysql:host=$host;dbname=$db",$user,$pass);
- parent::settAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- } catch(PDOException $e) {
- echo $dbError;
- file_put_contents($error, $e->getMessage() . "\n", FILE_APPEND);
- }
- }
- public function dbQuery($query, $sqlValues) {
- $qry = $this->prepare($query);
- $qry->execute($sqlValues);
- }
- public function getArray($query) {
- $asd = $this->dbQuery($query);
- $r = $asd->fetchAll();
- return $r;
- }
- }
- //$doh = new PDO("mysql:host=$host;dbname=$db",$user,$pass);
- $doh = new MySQL_Database;
- //$doh->setAttribute(PDO::ATTR_AUTOCOMMIT,FALSE);
- $doh->getArray('Select shitz');
- //või saad ka kutsuda
- MySQL_Database::loop('select shitz');
- ?>
Add Comment
Please, Sign In to add comment