<?php
error_reporting (E_ALL) ;
//connect to the mysql server or report error
require_once ('./mysql_connect.php'); // Connect to the db.
// Take variables passed from link
$cid = $GET['cid'];
$ord_num = $GET['ord_num'];
// select filename and path from db
$sql = "SELECT photo_filename, photo_caption, photo_id FROM gallery_photos WHERE category_id = $cid ORDER BY order_number DESC, $dbc";
// line 17 below
$qry = mysql_query($sql) or die(mysql_error);
while ($row = mysql_fetch_array($qry)) {
$pic = $row[0];