• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

Fatal Error: Class not found

Animal21

Neues Mitglied
Hallo leute,
hier mein php-code
PHP:
<?PHP
    include_once("db.php");
    
    class menu{
        static function displayGlobalMenu(){
            $db = new DataBase();
            $sql = "select `menuID`, `title`, `href` from al_menu";
            $res[] = $db->ReadRows($sql);
            $var = "<ul>";
            foreach($res as $data){
                $var .= "<li>".$data."</li>";
            }
            $var .= "</ul>";
            return $var;
        }
    }
?>
Fehlermeldung:
Fatal error: Class 'DataBase' not found in ...\...\system\classes\menu.php on line 6
mit line 6 ist folgendes gemeint:
$db = new DataBase();
dachte allerdings, dass die klasse durch "include_once("db.php");" eingebunden wäre...
hier die db.php:
PHP:
<?php
    public class DataBase{
         private $dbpraefix = "...";
        private $dbhost = "...";
        private $dbpassword = "...";
        private $dbuser = "...";
        private $db = "...";
        private $connection;
        private $query;
                
        public function __construct(){
            $this->Connect();
        }
        function Connect(){
            $this->connection = mysql_connect($this->dbhost, $this->dbuser, $this->dbpassword);
            mysql_select_db($this->db, $this->connection);
        }
        function Disconnect(){   
            mysql_close($this->connection);
        }      
        public function Execute($sql){ 
            $this->Connect();
            $this->query = mysql_query($sql);
            $this->Disconnect();
            return $this->query;
        } 
        public function EscapeString($text){
            return $this->connection->real_escape_string($text);
        }
        public function ReadRows($sql){
            $mysqlRes = $this->Execute($sql);
            while($row = mysql_fetch_object($mysqlRes)){
                res[] = $row;
            }
            return $res;
        }
    }
?>

mfg
ani
 
ha mein fehler, hatte das ganze schon eine ebene höher eingebunden mit include_once, nur hatte ich doch den falschen pfad...
[CLOSE]
 
Zurück
Oben