PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi all,
I was just wondering if it's a good idea to create a class for all the queries my site uses.. Basically i want to store all the queries on my db in a class instead of running them from different pages. Incase something needs to be changed then a class is easier to maintain then all the different pages...
What do you think about it, should or shouldn't I store all possible queries in a class or is it better to fire off queries from individual pages?
dreamline wrote:Hi all,
I was just wondering if it's a good idea to create a class for all the queries my site uses.. Basically i want to store all the queries on my db in a class instead of running them from different pages. Incase something needs to be changed then a class is easier to maintain then all the different pages...
What do you think about it, should or shouldn't I store all possible queries in a class or is it better to fire off queries from individual pages?
Thanks for any comments on this...
You hit the nail right on the head
It's far easier to maintain... and if you change the DB structure you don't have to edit all your pages, you just edit the class. Do it