Hallo leute,
hier mein php-code
Fehlermeldung:
hier die db.php:
mfg
ani
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;
}
}
?>
mit line 6 ist folgendes gemeint:Fatal error: Class 'DataBase' not found in ...\...\system\classes\menu.php on line 6
dachte allerdings, dass die klasse durch "include_once("db.php");" eingebunden wäre...$db = new DataBase();
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