Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once(realpath(dirname(__FILE__) . "/../resources/config.php"));
- class Database{
- var $con;
- var $last_result;
- var $dbhost;
- var $dbusername;
- var $dbpassword;
- var $dbname;
- function __construct($config){
- $this->dbhost = $config['db']['db1']['host'];
- $this->dbusername = $config['db']['db1']['username'];
- $this->dbpassword = $config['db']['db1']['password'];
- $this->dbname = $config['db']['db1']['dbname'];
- $this->con = new mysqli($this->dbhost,$this->dbusername,$this->dbpassword,$this->dbname);
- }
- public function query($query){
- if($result = $this->con->query($query)){
- if($result->num_rows > 0){
- $this->last_result = $result;
- return true;
- }
- else{
- return false;
- }
- }
- else{
- return false;
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment