include "../db.php4"; if (!isset($ord)) { $ord = 'title'; } if (isset($show)) { $rs = @mysql_query("SELECT t1.*, UNIX_TIMESTAMP(t1.drink) as drinkdate, COUNT(t2.CDID) as remaining FROM wine AS t1 LEFT JOIN wine AS t2 ON (t1.winery = t2.winery AND t1.year = t2.year AND t1.grape = t2.grape AND t2.drunk = 0) WHERE t1.drunk = 0 AND t1.drink < NOW() GROUP BY t1.CDID ORDER BY $ord ASC;"); } else if (isset($keyword)) { $rs = @mysql_query("SELECT t1.*, UNIX_TIMESTAMP(t1.drink) as drinkdate, COUNT(t2.CDID) as remaining FROM wine AS t1 LEFT JOIN wine AS t2 ON (t1.winery = t2.winery AND t1.year = t2.year AND t1.grape = t2.grape AND t2.drunk = 0) WHERE t1.title LIKE '%$keyword%' AND t1.drunk = 0 ORDER BY $ord ASC;"); } else if (isset($old)) { $rs = @mysql_query("SELECT *, UNIX_TIMESTAMP(drink) as drinkdate FROM wine WHERE drunk = 1 ORDER BY $ord ASC;"); } else { $rs = @mysql_query("SELECT t1.*, UNIX_TIMESTAMP(t1.drink) as drinkdate, COUNT(t2.CDID) as remaining FROM wine AS t1 LEFT JOIN wine AS t2 ON (t1.winery = t2.winery AND t1.year = t2.year AND t1.grape = t2.grape AND t2.drunk = 0) WHERE t1.drunk = 0 GROUP BY t1.CDID ORDER BY $ord ASC;"); } ?>
wine index
add new wine
Drink Date | wine description (bottles remaining) |
Grape | Region | Winery | Year | Location | |
Jan '70 | ... ( ) | , Row , Column | drink | delete |
@mysql_close($dbcnx); ?>