/** * @see IModel::sets() * @param $field * @param $value * @param $conditions * @return bool|mixed */ public function sets($field, $value, $conditions) { $data = array($field => $value); $conditions = SQL::create()->buildConditions($conditions); return $this->db->update($this->table, $data, $conditions); }
/** * @see \herosphp\db\interfaces\Idb::count() */ public function count($_table, $_conditons = null) { $_query = "SELECT count(*) as total FROM {$_table}"; if ($_conditons) { $_query .= " WHERE " . SQL::buildConditions($_conditons); } $_result = $this->query($_query); $_res = $_result->fetch(PDO::FETCH_ASSOC); return $_res['total']; }