Global Database Connection?
Posted: Thu Oct 19, 2006 10:08 am
Hi guys,
I have just started PHP, so please forgive me if my question is stupid. I am developing a simple customer application, where a user can log in and query a customer and the cutomer's purchases.
I have a database class which handles all database functionality e.g connects to the database etc. This class is called when a user logs on to the system. This validates the username and password, if these are corrrect it calls the query screen using Next a query screen appears allowing the user to query a customer id, which brings back the customer details from the database.
To get the details I have to call my database class again, connect and login into the database to retrieve the details.Surely there is another way to do this without creatng a new instance of the database class?
Any suggestions would be appreciated
Thanks
I have just started PHP, so please forgive me if my question is stupid. I am developing a simple customer application, where a user can log in and query a customer and the cutomer's purchases.
I have a database class which handles all database functionality e.g connects to the database etc. This class is called when a user logs on to the system. This validates the username and password, if these are corrrect it calls the query screen using
Code: Select all
header('location:queryuser.php');To get the details I have to call my database class again, connect and login into the database to retrieve the details.Surely there is another way to do this without creatng a new instance of the database class?
Any suggestions would be appreciated
Thanks