<?php
$photo_array=array();
$tr=0;
$cl=0;
$maxcol=3;
            $items_per_page=12;			
		    $table_name="images";	
			$WHERECLOSE="";
			$page_name=$_SERVER['PHP_SELF']."?"; 		   
		    include "paging.php";	
$sql_photogallery=mysql_query("SELECT id,imgname,image,display_order from images order by display_order asc,id desc LIMIT $from,$items_per_page");
if(mysql_num_rows($sql_photogallery) > 0){
while($photoresults=mysql_fetch_object($sql_photogallery)){
      $photo_array[$tr][$cl]=array(
	                       'id'=>$photoresults->id,
						   'imgname'=>$photoresults->imgname,
						   'image'=>$photoresults->image
						   );
					$cl++;	
		if($maxcol==$cl){
		$tr++; 
		$cl=0; 
		}			   
    }
}


       /* if(isset($_GET['cid'])){
		$cid=$_GET['cid'];
		$catsub_photoarray=array();
		$row=0;	
		$col=0;	
		$maxcol=3;
       $sqlcategory=mysql_query("SELECT id,imgname,image from images where pid='$cid' order by id desc");
      while($presults=mysql_fetch_object($sqlcategory)){
       $catsub_photoarray[$row][$col]=array(
	                       'id'=>$presults->id,
						   'imgname'=>$presults->imgname,
						   'image'=>$presults->image
						   );
					$col++;	 
			if($col==$maxcol){
			$row++;
			$col=0;
			}		  
}
}*/
?>