- Apr 17, 2003
- 910
- 0
- 0
I'm working on a site, it works fine but I want to use my own session handlers which store sessions in a MySQL database.
The problem I am having is just stumping me...I get this error message:
Notice that the query is valid; it works if entered directly (returns 0, as is expected). This isn't an issue with the MySQL query syntax.
This query is being called by a session handler callback function, which tells me that the handlers are being initialized properly, but get stuck when they need to access the DB.
The DB-Link message implies that the connection to the database is being dropped or for some reason is not available when my DB interface functions are called from within the session handler - but I KNOW the DB functions are working because they have been doing so for a long time, and there are calls made to the DB before the session is initialized...so they are not the problem.
I don't know why I am having this problem. I am aware of the issue with class-based session handlers dropping the DB connection prematurely, but this is not a class-based handler...it is procedural, so just a series of functions.
Is there something I don't know, like is there some reason I cannot use my DB functions within the handlers? I've seen code that does and it seems to work fine. I've wasted a lot of time trying to get this working and it's just not.
The problem I am having is just stumping me...I get this error message:
From PHP:
Warning: mysql_query(): 11 is not a valid MySQL-Link resource in /path/to/perfectly/fine/db/functions/that/have/been/working/for/years/
MySQL Query:
SELECT count(*) AS total FROM sessions WHERE skey = 'ed97c344f0547907c8b9c533a87b5af8'
Notice that the query is valid; it works if entered directly (returns 0, as is expected). This isn't an issue with the MySQL query syntax.
This query is being called by a session handler callback function, which tells me that the handlers are being initialized properly, but get stuck when they need to access the DB.
The DB-Link message implies that the connection to the database is being dropped or for some reason is not available when my DB interface functions are called from within the session handler - but I KNOW the DB functions are working because they have been doing so for a long time, and there are calls made to the DB before the session is initialized...so they are not the problem.
I don't know why I am having this problem. I am aware of the issue with class-based session handlers dropping the DB connection prematurely, but this is not a class-based handler...it is procedural, so just a series of functions.
Is there something I don't know, like is there some reason I cannot use my DB functions within the handlers? I've seen code that does and it seems to work fine. I've wasted a lot of time trying to get this working and it's just not.