Bei meinem Code versuche ich folgendes aufrufen…
index.php
[PHP]
//Datei holen
include „config/basicConstruct.php“;
//Basic Klasse erstellen
$index = new basic();
$error = $index->$mysql->GetLastError();
echo $error[‚typ‘];
echo „
\n“;
echo $error[‚report‘];
echo „
\n“;
[/PHP]
basicConstruct ausschnitt:
[PHP]
//Inludes
include „mysql.php“;
class basic
{
/* Gerüst */
//Eigenschaften
//Public
public $mysql;
//Protected
protected $getSiteResult;
protected $template;
protected $content;
//Konstruktor
public function __construct()
{
$this->mysql = new mysql();
}
…
[/PHP]
und jetzt mysql ausschnitt
[PHP]
include „data/mysqlConfig.inc“;
class mysql
{
/* Gerüst */
//Eigenschaften
//Public
public error;
//Protected
...
//Konstruktor
public function __construct($options = "connect")
{
$this->error['typ'] = "SUCC_DONE";
$this->error['report'] = "";
if($options == "connect")
{
$this->db = @mysql_connect(DB_HOST, DB_USER, DB_PASS);
if(!$this->db)
{
$this->error['typ'] = "NO_CONNECT";
$this->error['report'] = mysql_error();
}
if(!@mysql_select_db(DB_BASE))
{
$this->error['typ'] = "NO_BASE";
$this->error['report'] = mysql_error();
}
}
}
…
…
…
public function GetLastError()
{
return $error;
}
[/PHP]
das heißt ich greife auf die Methode GetLastError()
per basicConstruc zu. Quasi über eine andere Klasse.
Ich kriege bloß diesen Fehler:
Fatal error: Cannot access empty property in /srv/www/httpd/phost/g/com/pytalhost/gloryage/web/index.php on line 41
Die Zeile 41 in index.php
[PHP]
$error = $index->$mysql->GetLastError();
[/PHP]
Ich verstehe aber nicht, warum ich kein Zugang habe, auf mysql per basic.
greez web_spider