5 return mysqli_real_escape_string($RingDb->db
, $value);
10 function __construct($DBHost, $DBUserName, $DBPassword, $DefaultDBName) {
11 $this->host
= $DBHost;
12 $this->user
= $DBUserName;
13 $this->pass
= $DBPassword;
14 $this->default_name
= $DefaultDBName;
15 return $this->connect();
19 $this->db
= mysqli_connect($this->host
, $this->user
, $this->pass
) or die(errorMsgBlock(3004, 'DB', $this->host
, $this->user
));
23 function select($db='') {
27 $this->name
= $this->default_name
;
28 mysqli_select_db($this->db
, $this->name
) or die(errorMsgBlock(3005, 'DB', $this->name
, $this->host
, $this->user
));
31 function query($query) {
32 $result = mysqli_query($this->db
, $query) or die(errorMsgBlock(3006, $query, 'DB', $this->name
, $this->host
, $this->user
, mysqli_error($this->db
)));
34 if (!is_bool($result)) {
35 while ($row = mysqli_fetch_array($result))
41 function querySingle($query) {
42 $result = mysqli_query($this->db
, $query) or die(errorMsgBlock(3006, $query, 'DB', $this->name
, $this->host
, $this->user
, mysqli_error($this->db
)));
43 if (mysqli_num_rows($result))
44 return mysqli_fetch_array($result);
48 function getLastId() {
49 return mysqli_insert_id($this->db
);