dbprefix}digimina_subjects"; $total = get_data_row($query); return (int)$total->total; } else { return get_data("SELECT * FROM {$CONFIG->dbprefix}digimina_subjects ORDER BY name ASC"); } } /** * Returns subject options array as name => id * * @return array Empty array is teturned if no subjects */ function digimina_get_subjects_options() { $subjects = digimina_get_subjects(); $options = array(); if (is_array($subjects) && sizeof($subjects)>0) { foreach ($subjects as $subject) { $options[$subject->name] = $subject->id; } } return $options; } /** * Returns subject name by identifier * * @param int $id Identifier * * @return string|false */ function digimina_get_subject_name_from_id($id) { global $CONFIG; $id = (int)$id; $query = "SELECT name FROM {$CONFIG->dbprefix}digimina_subjects WHERE id = $id"; $row = get_data_row($query); if ($row) { return $row->name; } return false; }