spacing
[anyfivecardpokerhand.git] / include / classes / dbconnection.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
 
/**
 * Any five card poker hand generator db connection
 *
 * @author      Razvan Stanga <git@razvi.ro>
 */
 
class dbConnection {
        private $db = null;
        private $dbData = array ();
    private $dbQueryId;
 
        function __construct () {
                $this->dbData = parse_ini_file (appRoot."include/config/dbconnection.php", true);
                $this->dbConnect ();
        }
 
        private function dbConnect () {
                $this->db = new mysqli($this->dbData['sql_host'], $this->dbData['sql_user'], $this->dbData['sql_pass'], $this->dbData['sql_db'], $this->dbData['sql_port']);
        }
 
        public function dbQuery ($sqlQuery) {
                return $this->dbQueryId = $this->db->query ($sqlQuery);
        }
 
        public function dbFetchArray ($queryId) {
        if ($queryId == "") {
                $queryId = $this->dbQueryId;
        }
        if ( $queryId ) {
                return $queryId->fetch_array (MYSQLI_ASSOC);
        } else {
            return false;
        }
        }
}
 
?>
comments