include("include/connect.php");
$sqlCate="select * from ntphoto_tcate";
$queryCate = mysql_query($sqlCate) or die("Can't select cate : $sqlCate");
$main_id = !empty($_GET['id'])?$_GET['id']:1;
$subid = !empty($_GET['subid'])?$_GET['subid']:"";
$txtsubid = !empty($subid)?"and ntphoto_photo.sub_id ='$subid'":"";
$main_id2 = $_GET['id'];
$sqlSub = "select * from ntphoto_tcate where main_id='$main_id2'";
$querySub = mysql_query($sqlSub);
$numSub = mysql_num_rows($querySub);
$pid = $_GET['pid'];
$pageid = $_GET["pageid"];
if(isset($pid)){
$sql = "SELECT * FROM ntphoto_photo INNER JOIN ntphoto_tcate ON ntphoto_photo.main_id = ntphoto_tcate.cate_id where ntphoto_photo.main_id in (45) and ntphoto_photo.photo_id='$pid'";
$query = mysql_query($sql) or die("Can't Select cate : $sql");
$rs = mysql_fetch_array($query);
}
$sqlPhoto = "SELECT * FROM ntphoto_photo INNER JOIN ntphoto_tcate ON ntphoto_photo.main_id = ntphoto_tcate.cate_id WHERE ntphoto_photo.main_id in (45) and ntphoto_photo.main_id ='$main_id' $txtsubid order by photo_id desc";
$queryPhoto = mysql_query($sqlPhoto) or die("Can't select photo : $sqlPhoto");
$rsPhoto = mysql_fetch_array($queryPhoto);
$num = mysql_num_rows($queryPhoto);
if(trim($num)=='0'){
header("location:http://www.dailyxpress.net/specials/photogallery/showsection.php?id=$main_id");
}
$totalrecord = mysql_num_rows($queryPhoto);
$pagesize = 8;
$totalpage = (int) ($totalrecord / $pagesize);
if (($totalrecord % $pagesize) != 0) {
$totalpage += 1;
}
if (isset($pageid)) {
$start = $pagesize * ($pageid - 1);
}
else {
$pageid = 1;
$start = 0;
}
$sqlPhoto=$sqlPhoto." LIMIT $start, $pagesize";
$queryPhoto = mysql_query($sqlPhoto);
?>
include("inc_head_red.php");?>
Red shirts protest photogallery