View Single Post
Old 12-04-2007, 07:50 AM   #2 (permalink)
SOCK
The Acquainted
 
Join Date: Nov 2007
Posts: 154
Thanks: 31
SOCK is on a distinguished road
Default

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 Query, the argument named Query, an internal variable and return named... well you get the idea. It might make more sense to name the argument $sql, the return value $Result, 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.
SOCK is offline  
Reply With Quote