bunder5
-
Posts
4 -
Joined
-
Last visited
Posts posted by bunder5
-
-
That works but I don't get why sometimes it would be attempting to write to session before opening the session. I trapped it and it goes to write first and I have not done anything with sessions.
-
I altered your code to use PDO without any problems....except when one of my queries goes bad. Then I get two errors....
Fatal error: Call to undefined method PDOStatement::prepare() in \finalize.php on line 139
Fatal error: Call to a member function prepare() on a non-object in \db_sessions.inc.php on line 84
The first was from a failed query. The second is line #84 which is the write_session() function. The funny thing is that if I insert code to establish $dbc inside write_session() and rerun that would eliminate the second error.
Then I put simple echo statements in the open_session() and write_session() and whenever my query goes bad it fails to open_session() before write_session() which is why I get the second error. Do you know why this is happening?
Sorry for late response, I did not subscribe to topic.
-
I switched over to storing them into a db as done in the book but I notice that when my code has errors, often it leads to an error in the write_session() function. Calling on a function on a non-object, $dbc. The funny thing is that there is no code to write to the session but there is code to read session data.
It appears to be trying to write a session before opening the session and establishing a db connection. I confirmed it by putting code inside the write_session() function to open a new connection at each call.
Sessions Stored In Db Functions
in PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
Posted
Actually $dbc->error_code() is making my pages timeout. I am using isset() to see if that works.