<?php 

class DB
{
    var $conn = null;
    var $config = array(
        'username' => 'pixbetmastercom_userpixbetmaster',
        'password' => 'o?StyY?O,J]q',
        'hostname' => 'localhost',
        'database' => 'pixbetmastercom_admin2'
    );

    function __construct() {
        $this->connect();
    }

    function connect() {
        if (is_null($this->conn)) {
            $db = $this->config;
            $this->conn = mysql_connect($db['hostname'], $db['username'], $db['password']);
            if(!$this->conn) {
                die("Cannot connect to database server"); 
            }
            if(!mysql_select_db($db['database'])) {
                die("Cannot select database");
            }
        }
        return $this->conn;
    }
    
    public function executeReturnFetch($sql, $result_type = MYSQLI_BOTH)    {
        $result = mysql_query($sql);
        return mysql_fetch_array($result, $result_type);
    }
    public function executeReturn_FETCH_ASSOC($result)
    {
         $result = mysql_query($sql);
        while ($fetch = mysql_fetch_assoc($result)) {
            $rows[] = $fetch;
        }
        return $rows;
    }
}
?>