Rookietime : mySQL Query class
View Single Post
12-04-2007, 07:50 AM
Join Date: Nov 2007
I suppose it's fine, if that's what you want to do. The Query() method is pretty confined to strictly a) timing the query, b) performing the query and returning the Result Resource and c) killing the script if the query fails. These should be three seperate entities. The Query() method should do nothing but perform a dynamic SQL query. There should be a seperate mechanism to determine what happens to the object or script if the query fails. IMHO, an object should never be allowed to kill the script or perform any logic outside itself.
A word about variables. It's a bit confusing to have the method name
, the argument named
, an internal variable and return named... well you get the idea. It might make more sense to name the argument
, the return value
, etc. Just some constructive criticism, take it for what it's worth.
You're using an object; PHP 4 supports objects & classes (thus your ability to define a class), it just doesn't offer the support that PHP 5 does. Still, using an object is simple, the trick is to infuse polymorphism into your class design.
View Public Profile
Send a private message to SOCK
Find More Posts by SOCK