

<?

$_SESSION[catt]=" ";

 $cat="category_id=";

 

/*  function itechitems_11_1($ssid,$cat_dis)

{



 $ss_sql="select * from site_categories where category_head_id=$ssid";

 $sub_res=mysql_query($ss_sql);

    while($cat_row=mysql_fetch_array($sub_res))

   {

      $cat_dis="category_id=".$cat_row[category_id]." or ";

	  if($cat_row['category_id'])

	 {

	  $ssid=$cat_row['category_id'];

	 $_SESSION[catt]=$_SESSION[catt]."$cat_dis";

      itechitems_11_1($ssid,$cat_dis);

	 }

   }

    return "$cat";

} */

 

 

                            function itechitems_11($ssid,$cat)

                            {

 							$ss_sql="select * from site_categories where category_head_id=$ssid";

 							$sub_res=mysql_query($ss_sql);

    						while($cat_row=mysql_fetch_array($sub_res))

    						{

     						$cat_row[category_id];

     						$cat=$cat_row[category_id]." or category_id=";

     						if($cat_row['category_id'])

	 						{

	  						$ssid=$cat_row['category_id'];

	  						$_SESSION[catt]=$_SESSION[catt]."$cat";

	  						itechitems_11($ssid,$cat);

	 						}

   							}

  							}

 



 

 if($tot_rec>0)

 {

     $_SESSION[catt]=" ";

     $cat="category_id=$cate_id or category_id= ";

	 $_SESSION[catt]=$cat;

     while($cat_row=mysql_fetch_array($res))

     {

      $ssid=$cat_row[category_id];

	  if($ssid)

      {

	  $cat=$ssid." or category_id=";

      itechitems_11($ssid,$cat);

      $cat=$_SESSION[catt];

      }

	  $cat=rtrim($cat," or category_id=");

 }

 }

 else

 {

 $cat="category_id=$cate_id";

 }

if($view=="list")

{

  // $item_sql="select * from auction_details where selling_method='auction' and ( $cat ) and status='Active' and bid_starting_date <= now() "; 

  if($cat!="category_id=")

  {

   $item_sql="select * from auction_details where ( $cat ) and status='Active' and bid_starting_date <= now() "; 

  }

  else

   $item_sql="select * from auction_details where status='Active' and bid_starting_date <= now() "; 

  

}

else

{

   if($cat!="category_id=")

  {

  $item_sql="select a.* from auction_details a, featuredproducts b where $cat and gallery_feature='yes' and a.productid=b.productid and status='Active' and bid_starting_date <= now() group by a.productid "; 

  }

  else

  {

  $item_sql="select a.* from auction_details a, featuredproducts b where  gallery_feature='yes' and a.productid=b.productid and status='Active' and bid_starting_date <= now() group by a.productid "; 

   }

  

} 



// echo "test". "$item_sql";

 

 $recordset=mysql_query($item_sql);

 $total_records=mysql_num_rows($recordset);

 $rec_sql="select  * from genaralsettings where set_id=54";

 $rec_res=mysql_query($rec_sql);

 $rec_row=mysql_fetch_array($rec_res); 

 $limitsize=$rec_row[set_value]; 

 // $limitsize=5;

 if($total_records>0)

 { 

//get the total records

if(strlen($currec)==0) //check firstpage 

$currec = 1;  

$start = ($currec - 1) * $limitsize;

$end = $limitsize;

$item_sql .=" limit $start,$end";

}





 ?>

