Kod
Fatal error: Call to a member function close() on a non-object in D:\serwer\www\tpscorp.info\idawell.php on line 71
Oto pliki, w których moga być błędy...
<?php #idawell.php function __autoload( $module_name ) { require_once( $root_path. 'modules/' .$module_name. '.php' ); } class idawell { public function __construct( ) { $this -> load_Config( ); $this -> idawell_initialisation( ); // $this -> decode_URL( ); if( $config['update_Info'] <> '' ) $this -> tpl -> template_dir = $root_path . 'templates/'; $this -> tpl -> compile_dir = $root_path . 'templates/compiled/'; $this -> tpl -> config_dir = $root_path . 'templates/configs/'; $this -> tpl -> cache_dir = $root_path . 'templates/cache/'; $this -> load_activeModules( ); } public function load_Config( ) { require_once( 'config.php' ); } public function idawell_initialisation( ) { $GLOBALS['mod_mysql'] = new mod_mysql( $GLOBALS['config']['dbHost'], $GLOBALS['config']['dbUser'], $GLOBALS['config']['dbPass'], $GLOBALS['config']['dbName'] ); $this -> db = $GLOBALS['mod_mysql']; require_once( $root_path . 'modules/smarty/Smarty.class.php' ); $GLOBALS['mod_smarty'] = new Smarty; $this -> tpl = $GLOBALS['mod_smarty']; } public function load_activeModules( ) { /* $this -> modules_List = array( 'test', 'test2' ); foreach( $this -> modules_List as $var ) { $GLOBALS[$var] = new $var; } */ } public function module_publish( ) { /* $this -> db = $GLOBALS['mod_mysql']; $this -> tpl = $GLOBALS['mod_smarty']; foreach( $modules_List as $var ) { $this -> $var = $GLOBALS[$var]; } */ } public function __destruct( ) { $this -> db -> close( ); } } $idawell = new idawell; ?>
<?php # mod_mysql.php class mod_mysql extends idawell { private $connect_id; private $query_result; public $num_queries = 0; /** * Polaczenie z serwerem sql i wybranie bazy danych */ public function __construct( $sql_server, $sql_user, $sql_password, $database, $persistency = False ) { $this -> persistency = $persistency; $this -> user = $sql_user; $this -> password = $sql_password; $this -> server = $sql_server; $this -> dbname = $database; $this -> connect_id = ( $this -> persistency ) ? @mysql_pconnect( $this -> server, $this -> user, $this -> password ) : @mysql_connect( $this -> server, $this -> user, $this -> password ); if( $this -> connect_id ) { if( $database != '' ) { $this -> dbname = $database; if( !$dbselect ) { $this -> close( ); } } return $this -> connect_id; } } /** * Zamyka polaczenie z serwerem sql i zwalnia pamiec zajmowana przez wyniki */ public function close( ) { if( $this -> query_result ) { $this -> free_result( ); } } /** * Zwalnia pamiec zajmowana przez wynik */ private function free_result( $query_result = '' ) { if ( $query_result ) { return True; } return False; } /** * Zwraca tresc lub numer ostatniego komunikatu o bledzie */ public function error( $what = 'message' ) { return ( $what == 'message' ) ? mysql_error( $this -> connect_id ) : mysql_errno( $this -> connect_id ); } } ?>
Wiem, że troche namieszałem, ale chciałbym w taki sposób to rozwiązać, byłbym wdzięczny za pomoc...