Categories

'; $sql = 'SELECT m.category_id, g.group_id, g.group_nm, c.category_nm, c.fob_pg, count(*) FROM Merchant_Cool k, Merchant m, Merchant_Category c, Merchant_Cat_Group g WHERE k.merchant_id = m.merchant_id and m.category_id = c.category_id and c.group_id = g.group_id GROUP BY m.category_id'; $hold_id = 0; if ($r = mysql_query($sql)) { while (list($catId, $group_id, $group_nm, $catName, $pg, $cnt) = mysql_fetch_row($r)) { if ($hold_id != $group_id) { if ($hold_id != 0) echo ')

'; echo '

'.$group_nm.'

( '; $hold_id = $group_id; } else { echo ', '; } echo $catName; } } echo ')

'; } function storeOfTheDayHist() { fobHead(-5, 'Site of the Day', 'A Fountain of Bargains - Store of the Day', 'Store of the Day reviews', 'Store of the day reviews'); $sql = 'SELECT k.dt, k.site_nm, m.merchant_id, m.category_id, c.category_nm FROM Merchant_Cool k, Merchant m, Merchant_Category c WHERE k.dt <= curdate() and k.merchant_id = m.merchant_id and m.category_id = c.category_id ORDER BY dt DESC LIMIT 45'; echo showBlob(82); echo '

Reviews by Date

'; showCategories(); echo '
. . .
'; fobFoot("store of the day calendar"); } function groupSum($g) { list($group_nm, $short_desc) = sqlRow('SELECT group_nm, short_desc FROM Merchant_Cat_Group WHERE group_id = '.$g); fobHead(-1, 'Categories', "A Fountain of Bargains - ".$group_nm.' Reviews', $group_nm.' store reviews', $group_nm); echo '

Store of the Day: '.$group_nm.'

Store Reviews from the '.$group_nm.' category. Return to the Category Index.

'.$group_nm.' Reviews

'; $sql = 'SELECT k.merchant_id, k.dt, k.site_nm, c.category_id, c.category_nm, c.la_cat, c.fob_pg, c.short_desc FROM Merchant_Cool k, Merchant m, Merchant_Category c WHERE k.merchant_id = m.merchant_id and m.category_id = c.category_id and c.group_id = '.$g.' ORDER BY c.category_id, k.dt DESC'; $hold_id = 0; if ($r = mysql_query($sql)) { while (list($merchant_id, $dt, $site_nm, $category_id, $category_nm, $la_cat, $fob_pg, $short_desc) = mysql_fetch_row($r)) { if ($hold_id != $category_id) { if ($hold_id > 0) echo ''; echo '

'.$category_nm.'

'.$short_desc.' (links)

'; showCategories(); echo '
. . .
'; fobFoot("store of the day calendar"); } $g = (isset($_GET['g']))? intval($_GET['g']) : 0; if ($g > 0) groupSum($g); else storeOfTheDayHist(); ?>