$results = $db->GetAll("
SELECT membership, business_short, " . T_LISTINGS . ".selector, firmname, friendly_url, date, zip, loc_id, loc_text
FROM " . T_LISTINGS . "
INNER JOIN " . T_CONFIG_MEMBERSHIPS . " ON " . T_LISTINGS . ".membership=" . T_CONFIG_MEMBERSHIPS . ".selector
WHERE date_expire > NOW()
AND admin_approved=1
AND " . T_CONFIG_MEMBERSHIPS . ".featured_sidebox = 'YES'
AND " . T_LISTINGS . ".loc_id = '$location[id]'
AND " . T_LISTINGS . ".cat_id = " . (int)$_GET['id'] . "
GROUP BY " . T_LISTINGS . ".selector
ORDER BY RAND(), " . T_LISTINGS . ".membership
LIMIT 0, $config[sidebox_listing_number]
");