diff options
author | Andreas Jakum <aj-gh@users.noreply.github.com> | 2020-10-20 21:23:26 +0200 |
---|---|---|
committer | Andreas Jakum <aj-gh@users.noreply.github.com> | 2020-10-20 21:23:26 +0200 |
commit | 1d5c8cb96ad9a1a9f61991a19b1362142b074430 (patch) | |
tree | ad3bfdd4e2d5b2bd40397797af9383ea6f554034 | |
parent | 6752d4defb195739c66a7dec94570d41ea8d295a (diff) |
Migrate to mysqli to support PHP7.4 instead of stone-age PHP5.6 ..
-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); } } |