diff options
author | Andreas Jakum <aj-gh@users.noreply.github.com> | 2020-10-20 21:26:08 +0200 |
---|---|---|
committer | Andreas Jakum <aj-gh@users.noreply.github.com> | 2020-10-20 21:26:08 +0200 |
commit | b8f4795951c0c9b8f513bf3d0734da94a1d1d902 (patch) | |
tree | 42a7edd99211bcdb922659c889e4d6d803171226 /db.class.php | |
parent | f1d7967ade714138640b33753442b326fc900ab0 (diff) |
Migrate to mysqli to support PHP7.4 instead of stone-age PHP5.6 ..
Diffstat (limited to 'db.class.php')
-rw-r--r-- | db.class.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/db.class.php b/db.class.php index 1a3647f..afe463d 100644 --- a/db.class.php +++ b/db.class.php @@ -13,33 +13,33 @@ function DB($user, $pass, $host, $dbname) { } function connect() { - $this->db = mysql_connect($this->host, $this->user, $this->pass) + $this->db = mysqli_connect($this->host, $this->user, $this->pass) or $this->error("Verbindungsaufbau fehlgeschlagen"); - mysql_select_db($this->dbname); + mysqli_select_db($this->db, $this->dbname); } function error($msg) { - die($msg . ": " . @mysql_error()); + die($msg . ": " . @mysqli_error($this->db)); } function query($query) { - $this->res = mysql_query($query, $this->db) + $this->res = mysqli_query($this->db, $query) or $this->error("Fehler bei Datenbankanfrage"); } function escape_string($string) { - return mysql_real_escape_string($string, $this->db); + return mysqli_real_escape_string($this->db, $string); } function numObjects() { - return mysql_num_rows($this->res); + return mysqli_num_rows($this->res); } function getNextObject() { if (!$this->res) { return; } - return mysql_fetch_object($this->res); + return mysqli_fetch_object($this->res); } } |