Re[2]: [Phplib-users] Access denied, 2 databases, extrange error
Brought to you by:
nhruby,
richardarcher
From: 3s <3s...@se...> - 2002-08-01 07:42:11
|
Hi, after checking the proposals from woodbri and Donncha, still not working and I'm thinking that the problem must be solve in other way. Because its a conceptual matter possibly. The main problem, I think, it is the way I use PHPLIB into my applications. I'm not an OOP master obviouslly, will try to explain you, if you can sugest a better approach I'll appreciate very much your advice. Applications are build in many layers: 1-index page, load general modules, make security tasks and if all goes well, load the requested page, if not redirect to the home page 2-Page that calls, has their own code for make specific tasks calling to other modules: 3-db classes, one db class for every table or group of tables, including their own common methods for insert, update, etc in every class 4-template 5-layout 5a-layout calls other pages or modules needed for it own What is the problem? I make a new instance of the main db class in every method of every class that manage tables. Example: class categories extends pageNavigation { function categories(){ //calls to libs, language error files, etc } function add($array){ // HERE IT IS THE PROBLEM------------------------------------ // extension of the db_sql class with their own connection // parameters $q= new tbl; //----------------------------------------------------------- $query="insert into categories set bla, bla"; if(!$q->query($query)){ $this->error=$this->msg['NOCONNECTION']; return; } return TRUE; } } What is the advantage? every class for table manage, has their code very well enclosed and can be changed little by little. Every table class has also a constructor for call common libs, language files, etc. I have two different possibilities, change all my code to implement a new solution around PHPLIB db class or migrate to other database library and make a lot of work also. Regards, -- 3s <3s...@se...> |