function get_login_gids() { if (!empty($_SESSION['user'])) { $q = "SELECT gid FROM groups WHERE belongsto='%" . get_login_id() . "%'"; $res = db_fetch_query(db_query($q), SQLITE_NUM); if (isset($res['0']['0'])) { return $res['0']['0']; } else { return 0; } } else { die('no logged in user detected'); } }
function GetCategoryViewedTimes($categoryID) { $q = db_query("select viewed_times from " . CATEGORIES_TABLE . " where categoryID=" . (int) $categoryID); $r = db_fetch_query($q); return $r["viewed_times"]; }