Ergebnis 1 bis 4 von 4

Thema: mysqli PHP7.4 Fehler

Baum-Darstellung

  1. #1
    Senior Avatar von Uranjitsu
    Registriert
    May 2016
    Beiträge
    210
    Gefällt mir!
    223
    Du gefällst: 158

    mysqli PHP7.4 Fehler

    Hallo zusammen,

    bis PHP 7.3 keine Probleme. Nach der Umstellung auf PHP7.4 erhalte ich folgende Fehlermeldung:

    Code:
    Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /home/website/xyz.test.cc/includes/db_mysqli.php:37 Stack trace: #0 /home/website/xyz.test.cc/global.php(404): Db->__construct('XXXXX...', 'website_qc', '.xxxxx_', 'website_qc') #1 /home/website/xyz.test.cc/admin/admin_global.php(27): include_once('/home/website/...') #2 /home/website/xyz.test.cc/admin/index.php(25): require('/home/website/...') #3 {main} thrown in /home/website/xyz.test.cc/includes/db_mysqli.php on line 37
    db_mysqli.php
    PHP-Code:
    <?php
    if (!defined('ROOT_PATH')) {
      die(
    "Security violation");
    }

    class 
    Db {
      var 
    $no_error 0;
      var 
    $connection;
      var 
    $query_id 0;
      var 
    $query_count 0;
      var 
    $query_time 0;
      var 
    $query_array = array();
      var 
    $table_fields = array();

      function 
    __construct($db_host$db_user$db_password ""$db_name ""$db_pconnect 0) {
        
    $connect_handle "mysqli_connect";
        if (!
    $this->connection = @$connect_handle($db_host$db_user$db_password)) {
          
    $this->error("Could not connect to the database server (".safe_htmlspecialchars($db_host).", ".safe_htmlspecialchars($db_user).")."1);
        }
        if (
    $db_name != "") {
          if (!
    mysqli_select_db($this->connection$db_name)) {
            @
    mysqli_close($this->connection);
            
    $this->error("Could not select database (".safe_htmlspecialchars($db_name).")."1);
          }
        }
        
    mysqli_set_charset($this->connection'utf8');
        return 
    $this->connection;
      }

      function 
    escape($value) {
        return 
    mysqli_real_escape_string($this->connection$value);
      }

      function 
    close() {
        if (
    $this->connection) {
          if (
    $this->query_id) {
            @
    mysqli_free_result($this->query_id);
          }
          return @
    mysqli_close($this->connection);
        }
        else {
          return 
    false;
        }
      }

      function 
    query($query "") {
        unset(
    $this->query_id);
        if (
    $query != "") {
          if ((
    defined("PRINT_QUERIES") && PRINT_QUERIES == 1) || (defined("PRINT_STATS") && PRINT_STATS == 1)) {
            
    $startsqltime explode(" "microtime());
          }
          if (!
    $this->query_id = @mysqli_query($this->connection$query)) {
            
    $this->error("<b>Bad SQL Query</b>: ".safe_htmlspecialchars($query)."<br /><b>".safe_htmlspecialchars(mysqli_error($this->connection))."</b>");
          }
          if ((
    defined("PRINT_QUERIES") && PRINT_QUERIES == 1) || (defined("PRINT_STATS") && PRINT_STATS == 1)) {
            
    $endsqltime explode(" "microtime());
            
    $totalsqltime round($endsqltime[0]-$startsqltime[0]+$endsqltime[1]-$startsqltime[1],3);
            
    $this->query_time += $totalsqltime;
            
    $this->query_count++;
          }
          if (
    defined("PRINT_QUERIES") && PRINT_QUERIES == 1) {
            
    $query_stats htmlentities($query);
            
    $query_stats .= "<br><b>Querytime:</b> ".$totalsqltime;
            
    $this->query_array[] = $query_stats;
          }
          return 
    $this->query_id;
        }
      }

      function 
    fetch_array($query_id = -1$assoc 0) {
        if (
    $query_id != -1) {
          
    $this->query_id $query_id;
        }
        if (
    $this->query_id) {
          return (
    $assoc) ? mysqli_fetch_assoc($this->query_id) : mysqli_fetch_array($this->query_id);
        }
      }

      function 
    free_result($query_id = -1) {
        if (
    $query_id != -1) {
          
    $this->query_id $query_id;
        }
        return @
    mysqli_free_result($this->query_id);
      }

      function 
    query_firstrow($query "") {
        if (
    $query != "") {
          
    $this->query($query);
        }
        
    $result $this->fetch_array($this->query_id);
        
    $this->free_result();
        return 
    $result;
      }

      function 
    get_numrows($query_id = -1) {
        if (
    $query_id != -1) {
          
    $this->query_id $query_id;
        }
        return 
    mysqli_num_rows($this->query_id);
      }

      function 
    get_insert_id() {
        return (
    $this->connection) ? @mysqli_insert_id($this->connection) : 0;
      }

      function 
    get_next_id($column ""$table "") {
        if (!empty(
    $column) && !empty($table)) {
          
    $sql "SELECT MAX($column) AS max_id
                  FROM 
    $table";
          
    $row $this->query_firstrow($sql);
          return ((
    $row['max_id'] + 1) > 0) ? $row['max_id'] + 1;
        }
        else {
          return 
    NULL;
        }
      }

      function 
    get_numfields($query_id = -1) {
        if (
    $query_id != -1) {
          
    $this->query_id $query_id;
        }
        return @
    mysqli_num_fields($this->query_id);
      }

      function 
    get_fieldname($query_id = -1$offset) {
        if (
    $query_id != -1) {
          
    $this->query_id $query_id;
        }
        return @
    mysqli_fetch_field($this->query_id$offset);
      }

      function 
    get_fieldtype($query_id = -1$offset) {
        if (
    $query_id != -1) {
          
    $this->query_id $query_id;
        }
        return @
    mysqli_fetch_field($this->query_id$offset);
      }

      function 
    affected_rows() {
        return (
    $this->connection) ? @mysqli_affected_rows($this->connection) : 0;
      }

      function 
    is_empty($query "") {
        if (
    $query != "") {
          
    $this->query($query);
        }
        return (!
    mysqli_num_rows($this->query_id)) ? 0;
      }

      function 
    not_empty($query "") {
        if (
    $query != "") {
          
    $this->query($query);
        }
        return (!
    mysqli_num_rows($this->query_id)) ? 1;
      }

      function 
    get_table_fields($table) {
        if (!empty(
    $this->table_fields[$table])) {
          return 
    $this->table_fields[$table];
        }
        
    $this->table_fields[$table] = array();
        
    $result $this->query("SHOW FIELDS FROM $table");
        while (
    $row $this->fetch_array($result)) {
          
    $this->table_fields[$table][$row['Field']] = $row['Type'];
        }
        return 
    $this->table_fields[$table];
      }

      function 
    error($errmsg$halt 0) {
        if (!
    $this->no_error) {
          global 
    $user_info;
          if (!
    defined("4IMAGES_ACTIVE") || (isset($user_info['user_level']) && $user_info['user_level'] == ADMIN)){
            echo 
    "<br /><font color='#FF0000'><b>DB Error</b></font>: ".$errmsg."<br />";
          } else {
            echo 
    "<br /><font color='#FF0000'><b>An unexpected error occured. Please try again later.</b></font><br />";
          }
          if (
    $halt) {
            exit;
          }
        }
      }
    // end of class
    ?>
    global.php
    PHP-Code:
    //-----------------------------------------------------
    //--- Start DB ----------------------------------------
    //-----------------------------------------------------
    include_once(ROOT_PATH.'includes/db_'.strtolower($db_servertype).'.php');
    $site_db = new Db($db_host$db_user$db_password$db_name); 
    Hat jemand Ahnung was geändert werden muss?

    LG
    Geändert von Uranjitsu (19.12.2019 um 20:35 Uhr)
    LG - Uranjitsu

Ähnliche Themen

  1. Turbobit.net ssl fehler
    Von CrackDavid im Forum IntelliTool.it
    Antworten: 1
    Letzter Beitrag: 26.06.2021, 19:04
  2. ssl Fehler
    Von murat im Forum IntelliTool.it
    Antworten: 1
    Letzter Beitrag: 31.01.2020, 14:20
  3. SQL Fehler?
    Von G_P im Forum Filecrypt.cc - Ankündigungen
    Antworten: 4
    Letzter Beitrag: 18.03.2018, 19:21
  4. Win Rar Fehler?
    Von Xyz121212 im Forum IntelliTool.it
    Antworten: 0
    Letzter Beitrag: 18.11.2017, 09:04
  5. (Erledigt) - 2 Fehler und ein grosses Lob
    Von maz im Forum Filecrypt.cc - Anregung & Kritik
    Antworten: 17
    Letzter Beitrag: 06.02.2016, 19:57

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •  
SzeneBox.org... im Mittelpunkt der Szene!
© since 2015 szeneBOX.org - All Rights Reserved
Domains: www.szenebox.org