Das war nach dem versuch was in den zwei oberen links beschrieben ist, habe es auch wieder zurückgestellt.
Ich habe nicht viel Ahnung von php vielleicht habe ich auch etwas falsch gemacht sonst würde ich hier nicht um Hilfe bitten.
Grüß
Thomas
Das war nach dem versuch was in den zwei oberen links beschrieben ist, habe es auch wieder zurückgestellt.
Ich habe nicht viel Ahnung von php vielleicht habe ich auch etwas falsch gemacht sonst würde ich hier nicht um Hilfe bitten.
Grüß
Thomas
PHP Fatal error: Uncaught Error: Call to a member function getgetConnection() on string
PHP Warning: Use of undefined constant DatabaseFactory - assumed 'DatabaseFactory' (this will throw an Error in a future version of PHP)
PHP Fatal error: Constructor MyObject::MyObject() cannot be static
PHP Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting '['
PHP Fatal error: Uncaught Error: Call to undefined function MyLogger()
Hallo Stef,
hat leider nichts geholfen. Habe einiges ausprobiert was dort beschrieben wurde und jedes mal war die Homepage nicht mehr zu sehen dafür jede menge Errors in der error_log
Hier mal die ganze Code:
function MyObject($table, $vars = null)
{
$this->con =& DatabaseFactory::getConnection(); //das ist die line 105
$this->setTable($this->con->prefix($table));
if(!empty($vars))
{
if(is_array($vars))
{
$this->assignVars($vars);
}
else
{
$id = intval($vars);
$this->load($id);
$this->unsetNew();
}
}
else
{
$this->setNew();
}
}
Alles anzeigen
function &getConnection()
{
static $database;
$config_manager =& MyConfigManager::getInstance();//das ist die line 39
$CONFIG =& $config_manager->getconfig();
$db_type = '';
if (!isset($database))
{
if(isset($CONFIG) && $CONFIG['database'] != '')
{
$db_type = $CONFIG['database'];
}
else
{
$db_type = 'mysql';
}
$file = SCRIPT_ROOT_PATH.'/class/database/driver/class.'.$db_type.'.php';
if(!is_readable($file))
{
$db_type = 'mysql';
}
else
{
require_once $file;
}
$class = ucfirst($db_type).'Database';
$database = new $class($CONFIG['db_login'],$CONFIG['db_pass'],$CONFIG['db_host'],$CONFIG['db_name'], $CONFIG['db_prefix']);
}
return $database;
}
}
Alles anzeigen
function MysqlDatabase($user, $pwd , $alias='', $dbname, $db_prefix = '')
{
$this->error = '';
$this->con_id = ($GLOBALS["___mysqli_ston"] = mysqli_connect($alias, $user, $pwd)) or die(mysqli_error($GLOBALS["___mysqli_ston"]));
if (!$this->con_id) {
$this->setError();
} else {
$this->database($dbname);
}
$this->prefix = $db_prefix;
$this->logger =& MyLogger::getInstance(); //das ist die line 46
}
Alles anzeigen
Hallo Leute,
habe gerade in meine error_log reingeschaut und ein paar Warnungen werden mir angezeigt bei denen ich keinen Ahnung habe
PHP Deprecated: Non-static method DatabaseFactory::getConnection() should not be called statically on line 105
Non-static method MyConfigManager::getInstance() should not be called statically on line 39
Non-static method MyLogger::getInstance() should not be called statically on line 46
kann mir dabei jemand helfen?
Freue mich über eure Antworten.
Grüße
Thomas
Hallo cottton der erste Code hat super funktioniert danke dafür.
Kannst du mir noch bitte beim zweiten helfen?
Hallo,
ich habe an meinem Script ein paar Änderungen gemacht das es unter PHP 7 funktioniert doch an zwei Meldungen komme ich nicht weiter
Hoffe das mir jemand von euch helfen kann.
Folgende Felermeldungen:
Warning: Declaration of MysqlDatabase::select($query, $class = 'recordset') should be compatible with MyDatabase::select()
Warning: Declaration of MysqlDatabase::execute($query) should be compatible with MyDatabase::execute()
bei ersten habe ich in der Datei stehen:
function select($query,$class='recordset')
{
$hashedQuery = md5($query);
if (!$this->con_id) {
return false;
}
if(!isset($this->queries[$hashedQuery]))
{
$cur = mysqli_query( $this->con_id, $query, MYSQLI_USE_RESULT);
// Logging Queries
$this->logger->addQuery();
if ($cur)
{
# Insertion dans le reccordset
$i = 0;
$arryRes = array();
while($res = mysqli_fetch_row($cur))
{
for($j=0; $j<count($res); $j++)
{
$arryRes[$i][strtolower(((($___mysqli_tmp = mysqli_fetch_field_direct($cur, $j)->name) && (!is_null($___mysqli_tmp))) ? $___mysqli_tmp : false))] = $res[$j];
}
$i++;
}
$this->queries[$hashedQuery] = new $class($arryRes);
}
else
{
$this->setError();
$this->queries[$hashedQuery] = false;
}
}
return $this->queries[$hashedQuery];
}
Alles anzeigen
und beim zweiten:
function execute($query)
{
if (!$this->con_id) {
return false;
}
$cur = mysqli_query( $this->con_id, $query);
// Logging Queries
$this->logger->addQuery();
if (!$cur) {
$this->setError();
return false;
} else {
return true;
}
Alles anzeigen
Freue mich über eure Antworten.
Grüße
Thomas
HTML-Seminar.de - mit Videos zum schnellen Lernen, wie man eine Website selbst erstellt.