Hi,
I have 2 different classes.
1) MySQL - class.mysql.php
2) Cart - class.cart.php
The MySQL class allows me to efficiently write/execute queries. The cart class has functions like AddToCart, UpdateCart, and DeleteFromCart. However, to perform those functions I need to connect to the database and execute a query.
What is the best way to 'include' the functionality contained in the MySQL class to the Cart class? Should I do a "class extend", or simply 'include' the class.mysql.php file and create a new instance of the database class in each function?
Or could I create one instance of the MySQL class ($MYSQL = new MySQL😉 at the top of the Cart class and would that apply to all the functions within the Cart class?
I'd like to do this the "right way", so any help would definitely be appreciated!