<?php
	include "../db_connection/db_connection.php";
	include "../config/config.php";
	$slct_html='';
	$str_limit=25;

			if($_REQUEST['start']!=''){
				$str_limit = $_REQUEST['start'];
			}

			$SLCT1 = mysqli_query($connect,"SELECT * FROM master_cat ORDER BY master_cat_id ASC");
			$result_rows = mysqli_num_rows($SLCT1);

			$SLCT = "SELECT * FROM master_cat ORDER BY master_cat_id ASC limit ".$str_limit.",25";

			$QURY = mysqli_query($connect,$SLCT);
			$loop=$str_limit+1;
			$cntrows = mysqli_num_rows($QURY);
			if($cntrows>0)
			{

			while($FTCH = mysqli_fetch_object($QURY))
			{
				if($loop%2 != "0")
					$bg = "gradeX";
				else
					$bg = "class='gradeC'";
				$cat = ucfirst($FTCH->category);
				$SLCT_cad = "SELECT  * FROM master_cad_type WHERE master_cad_type_id = $FTCH->master_cad_type_id ";
				$QURY_cad = mysqli_query($connect,$SLCT_cad);
				if(mysqli_num_rows($QURY_cad)>0)
				{
					$FTCH_cad = mysqli_fetch_object($QURY_cad);
					$type_name = $FTCH_cad->type_name;
				}else{
					$type_name = '';
				}
				
				$slct_html .='<div class="rowGroup">
    <div class="row">
      <div class="cell">'.$loop.'</div>
      <div class="cell">'.$type_name.'</div>
      <div class="cell">'.$cat.'</div>
      <div class="cell">'.$FTCH->cat_name.'</div>
	  <div class="cell">'.$FTCH->master_cat_name.'</div>
	  <div class="cell">'.$FTCH->cat_expantion.'</div>
	  <div class="cell">'.number_format($FTCH->cost_vl,2).'</div>
    </div>
  </div>';

				/*$slct_html .='<tr '.$bg.'>
						<td align="center">'.$loop.'</td>
						<td align="center">'.$type_name.'</td>
						<td align="center">'.$cat.'</td>
						<td align="center">'.$FTCH->cat_name.'</td>
						<td align="center">'.$FTCH->master_cat_name.'</td>
						<td align="center">'.$FTCH->cat_expantion.'</td>
						<td align="center">'.number_format($FTCH->cost_vl,2).'</td>
				</tr>';*/

				$loop ++;
			 }
			 }

			 echo $slct_html.'&#&'.$cntrows.'&#&'.$result_rows;
?>
