-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all
I've been wrestling with a problem that has, as far as I'm aware, no
reason to be happening unless php handling of OOP and Sessions is to
blame. This note looks long, but has been *seriously* condensed!


I have an application set up like this (bear with me it *is* simple :-)

*   Database (MySQL)
*   Class to handle add, edit, delete, list etc (basic functionality)
*   Admin program  // use the class and forms etc to allow admin of db

Now the problem appears to be with the sessions and class: the Admin
program is just a big switch statement that reloads itself eachtime like
this:

switch($mode) {
    case "add":
    do_some_adding();
    break;
}

and etc with all the other things it needs to do.

******* The ERROR *********

I'm getting 'Access denied' errors sometimes and the only cure I've
found is this:

if I instantiate the class at the top of the Admin program and it
accesses the db then the next time it needs to access the db it wil fail
unless I instantiate a new class? 

Very odd. 

The class holds properties of $this->user, $this->host, $this->pass and
uses them in an private method $this->_db_connect() so I see no reason
why it should be doing this.

It doesn't appear to be losing the properties, just not being able to
connect to the db.


***** Conclusion *******

Until someone points out the blindingly stupid mistake I'm making ;-)
I'll have to assume their is some OOP/Sessions problem, sure I have a
solution, but it is very messy, inelegant, and destroys the point of
using a class and session for this purpose.

Can anyone shed any light on this?

Many thanks
- -- 
Nick Wilson     //  www.explodingnet.com



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE89JB5HpvrrTa6L5oRArInAKCbmvkGII1uJ5Olmm3oRFyTUhlnDwCeL/xp
Jm00SFzoHn/NNqNuGSCj0Vs=
=d6TN
-----END PGP SIGNATURE-----

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to