Web_spider
Neues Mitglied
Bei meinem Code versuche ich folgendes aufrufen...
index.php
basicConstruct ausschnitt:
und jetzt mysql ausschnitt
das heißt ich greife auf die Methode GetLastError()
per basicConstruc zu. Quasi über eine andere Klasse.
Ich kriege bloß diesen Fehler:
Die Zeile 41 in index.php
Ich verstehe aber nicht, warum ich kein Zugang habe, auf mysql per basic.
greez web_spider![Big Grin :D :D](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f600.png)
index.php
PHP:
//Datei holen
include "config/basicConstruct.php";
//Basic Klasse erstellen
$index = new basic();
$error = $index->$mysql->GetLastError();
echo $error['typ'];
echo "<br />\n";
echo $error['report'];
echo "<br />\n";
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();
}
...
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;
}
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();
Ich verstehe aber nicht, warum ich kein Zugang habe, auf mysql per basic.
greez web_spider
![Big Grin :D :D](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f600.png)