/** * Shorthand fetch single row using specified column and value. * * @param string $tableName * The name of the table to select from. * @param string $column * (optional) Column name to query on. * @param integer $value * (optional) The value of the column. * @return An associative array of the table row. */ public static function get($tableName, $column = null, $value = null) { $sth = DKY_DB::build($tableName); if (!empty($column) && !empty($value)) { $sth->where("`" . $column . "` = :" . $column . "", $column, $value); } return $sth->find(true); }
public function getGroups($bShort = false) { $do_group = DKY_DB::build("group"); $do_group->find(); $aGroups = array(); while ($aGroup = $do_group->fetch()) { if (!$bShort) { $aGroups[$aGroup["group_id"]] = $aGroup; } else { $aGroups[$aGroup["group_id"]] = $aGroup["label"]; } } return $aGroups; }
public static function deleteItemGroups($itemId) { $do_item_group = DKY_DB::build("item_group"); $do_item_group->where("`item_id` = :itemId", "itemId", $itemId); return $do_item_group->delete(); }