<?php
/** label list */
function get_label_list($where = 1, $orderby = 'label_id', $start = 0, $pagesize = 0) {
	global $DB;
	
	$sql = "SELECT label_id, label_name, label_intro FROM ".$DB->table('labels')." WHERE $where ORDER BY $orderby DESC LIMIT $start, $pagesize";
	$result = $DB->fetch_all($sql);
	
	return $result;
}
	
/** one label */
function get_one_label($label_id) {
	global $DB;
	
	$sql = "SELECT * FROM ".$DB->table('labels')." WHERE label_id=$label_id LIMIT 1";
	$result = $DB->fetch_one($sql);
	
	return $result;
}

/** labels */
function get_labels() {
	global $DB;
	
	$links = load_cache('labels') ? load_cache('labels') : $DB->fetch_all("SELECT label_name, label_content FROM ".$DB->table('labels')." ORDER BY label_id ASC");
	
	return $links;
}
?>