not work
Notice: Undefined variable: db in C:\xampp\htdocs\elk104\Ajac\lib\class\CustomAJAXChat.php on line 19
Fatal error: Call to a member function database() on null in C:\xampp\htdocs\elk104\Ajac\lib\class\CustomAJAXChat.php on line 19
class CustomAJAXChat extends AJAXChat {
// Initialize custom configuration settings
function initCustomConfig() {
global $db_name,$db_connection;
$db->database();
// Use the existing ElkArte database connection:
$this->setConfig('dbConnection', 'link', $db_connection);
}
// Override the database connection method to make sure the ElkArte database is selected:
function initDataBaseConnection() {
global $db_name;
// Call the parent method to initialize the database connection:
parent::initDataBaseConnection();
// Select the ElkArte database:
$this->db->select($db_name);
if($this->db->error()) {
echo $this->db->getError();
die();
}
}
CustomAJAXChat.php
class CustomAJAXChat extends AJAXChat {
// Initialize custom configuration settings
function initCustomConfig() {
global $db_name,$db_connection;
// Use the existing ElkArte database connection:
$this->setConfig('dbConnection', 'link', $db_connection);
}
// Override the database connection method to make sure the ElkArte database is selected:
function initDataBaseConnection() {
global $db_name;
// Call the parent method to initialize the database connection:
parent::initDataBaseConnection();
// Select the SMF database:
$this->db->select($db_name);
if($this->db->error()) {
echo $this->db->getError();
die();
}
}