This commit is contained in:
Daniel Mason 2017-01-01 00:23:57 +13:00
parent b6876e601e
commit 0824aca6b9
4 changed files with 42 additions and 9 deletions

View file

@ -8,10 +8,11 @@ class DataItem {
$this->_db = new db(); //Will optimise this to get existing conn at some point.
}
public function getById($id) {
$this->_db->query("SELECT * FROM `".static::_getType()."` WHERE ".static::_getType()."_id = :id");
$this->_db->bind(":id", $id);
return $this->_db->getObject();
public static function getById($id) {
$db = new db();
$db->query("SELECT * FROM `".static::_getType()."` WHERE ".static::_getType()."_id = :id");
$db->bind(":id", $id);
return $db->getObject();
}
private function _getAllWhere($where = false, $orderBy = false, $join = false, $limit = false) {