i w niej metody przykladowe:
{ $this->_handleErrors(); } else { $this->_db['db_host'] = $_param['db_host']; $this->_db['db_name'] = $_param['db_name']; $this->_db['db_user'] = $_param['db_user']; $this->_db['db_pass'] = $_param['db_pass']; $this->_db['db_name2'] = "sessions"; } // if $gc_maxlifetime is specified and is an integer number // set the new value } // if $gc_probability is specified and is an integer number // set the new value } // if $gc_divisor is specified and is an integer number // set the new value } // get session lifetime // register the new handler ); register_shutdown_function('session_write_close'); // start the session } public function open($save_path, $session_name) { try{ $this->_dbh = new PDO('mysql:dbname='.$this->_db['db_name'].';host='.$this->_db['db_host'], $this->_db['db_user'], $this->_db['db_pass']); } catch(PDOException $e){ } return true; } function read($session_id) { // reads session data associated with the session id // but only if the HTTP_USER_AGENT is the same as the one who had previously written to this session // and if session has not expired foreach($this->_dbh->query(" SELECT session_data FROM session_data WHERE session_id = '".$session_id."' AND http_user_agent = '".$_SERVER["HTTP_USER_AGENT"]."' AND ") as $row); // if anything was found if ($row > 0) { // return found data return $row["session_data"]; }
NIe wiem czemu nie łączy mi z baza danych oraz czemu wypisuje ze nie rozpoznaje zapytania query
SQLSTATE[28000] [1045] Access denied for user 'ODBC'@'localhost' (using password: NO)
Fatal error: Call to a member function query() on a non-object in C:\xampp\htdocs\pobieralnia\user\include\class_session.php on line 166
Dane do mysql dobre bo wcześniej się łączyłem i łączyło mi przez PDO
skoro select w pdo wywoluje sie za pomoca query. ?