# LJG if register_globals is off, the following emulates it for this
# set of scripts:
# NOTE: before everything else, so any local vars override this.
# it's slightly more secure this way.
while( list($key,$value) = each($_GET)) {
$$key = $value;
}
$connection = @mysql_connect("dbhost","adminsql","sizy4mot") or die (mysql_error());
$db = @mysql_select_db(talbot_pusey,$connection) or die(mysql_error());
$cat = "select category from category where id = '$cat_id'";
$result = mysql_query($cat) or die;
$cats = mysql_fetch_array($result);
$category = $cats["category"];
$query = "select distinct title.id, title,category.id as catid from title,category,image where category.id = '$cat_id' and title.id = tid and category.id=cat_id";
$result = mysql_query($query) or die("Error: " . mysql_error());
?>
The Pusey Collection
Pusey Collection > By Category > echo "$category"; ?>
while ($row = mysql_fetch_array($result)) {
$title = $row["title"];
$id = $row["id"];
$cat_id = $row["catid"];
$sql = "select count(image.id) as counter from image,category where tid = $id and $cat_id=cat_id and category.id=cat_id";
$sql_result = mysql_query($sql) or die("Error: " . mysql_error());
while ($row2 = mysql_fetch_array($sql_result)) {
$count = $row2["counter"];
}
?>
&cat_id= echo "$cat_id"; ?>"> echo "$title";?> if ($count > 1) {echo " (with $count views)";}?>
}
?>