Page 1 of 1

Need some advice about a sql class

Posted: Mon Feb 06, 2006 9:27 am
by dreamline
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... :D

Re: Need some advice about a sql class

Posted: Mon Feb 06, 2006 9:30 am
by Chris Corbyn
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... :D
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 ;)

Posted: Mon Feb 06, 2006 9:38 am
by dreamline
Thanks d11wtq for your quick answer.. :) I think, no i am sure, i will follow your advice and create an sql class.. :D