# 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);
$catdisp = $cats["category"];
$limit = 5;
$numresults = mysql_query ("select tid from image where tid = '$tid' and cat_id = '$cat_id'");
$numrows = mysql_num_rows($numresults);
if (empty($offset)) {
$offset=0;
}
$pages = intval($numrows/$limit);
if ($numrows%$limit) {
$pages ++;
}
$first = $offset + 1;
if (!((($offset + $limit) / $limit) >= $pages) && $pages != 1) {
$last = $offset + $limit;}
else{
$last = $numrows;}
$query = "select image.id, title, category, creator, date, barcode from title, category, creator, image where tid = '$tid' and category.id = '$cat_id' and title.id = tid and cat_id = category.id and cid=creator.id limit $offset, $limit";
$result = mysql_query($query) or die("Error: " . mysql_error());
if (mysql_num_rows($result) == 0)
echo ("No images found.");
?>
The Pusey Collection
Pusey Collection > By Category > "> echo "$catdisp"; ?>
Displaying - of images.
$class1 = "even";
$class2 = "odd";
$row_count = 0;
while(list($id,$title,$category,$creator,$date,$barcode) = mysql_fetch_row($result))
{
$class = ($row_count % 2) ? $class1 : $class2;
$size = GetImageSize ("images/t_$barcode.jpg");
?>
"> .jpg" alt="" border="0"> |
Title: |
echo "$title"; ?> |
Collection: |
echo "$category";?> |
Creator: |
echo "$creator"; ?> |
Creation Date: |
echo "$date"; ?> |
Barcode: |
3353600 echo "$barcode"; ?> |
$row_count ++;
}
?>
|
if ($offset >=1) {
$prevoffset = $offset - 5;
echo("
PREV ");
}
//moving $pages = intval... to $pages ++; and the } to the top
for ($i = 1; $i <= $pages; $i++) {
$newoffset = $limit*($i-1);
echo ("
$i ");
}
if (!(($offset/$limit) == ($pages -1)) && ($pages !=1)) {
$newoffset=$offset+$limit;
echo("
NEXT");
}
?>