Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class database {
- private $hostname = '127.0.0.1';
- private $username = 'root';
- private $password = '************';
- private $database = 'womj';
- private $connection = null;
- public function __construct() {
- try {
- $this->connection = new PDO('mysql://' . $this->hostname . '/' . $this->database, $this->username, $this->password);
- } catch (PDOException $ex) {
- exit($ex->getMessage());
- }
- }
- public function fetchResults($query) {
- $stmt = $this->connection->prepare($query);
- $params = array_splice(func_get_args(), 1);
- $stmt->execute($params);
- return $stmt->fetchAll(PDO::FETCH_OBJ);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement