-
$db = null; is NOT the way to go.
-
Get rid of all
try catch
operators. They just make mo sense. If you remove them, nothing would really change, because exceptions can report themselves, no assistance required, thank you -
Get git of all that
global
stuff. It's just gross. A class has its own means to persist the state. At least use astatic
variable to hold the connection. Better yet, do not use that static magic at all, create a regular instance with a constructor. -
Do not duplicate the code. All functions contain almost identical code. Reuse the functions, Luke!
public static function query($sqlquery, $inserts = array()){ $stmt = static::db->prepare($sqlquery); $stmt->execute($inserts); return $stmt;
}