<?php
	include "pagination.class.php";
	include "db_connection/db_connection.php";
	include "config/config.php";
$perPage = new PerPage();

$sql = "SELECT * FROM design_det WHERE master_cat_id='2' and operation_type='1' ORDER BY design_det.design_det_id ASC";
$paginationlink = "getresult.php?page=";	
$pagination_setting = $_GET["pagination_setting"];

$page = 1;
if(!empty($_GET["page"])) {
$page = $_GET["page"];
}

$start = ($page-1)*$perPage->perpage;
if($start < 0) $start = 0;

$query =  $sql . " limit " . $start . "," . $perPage->perpage; 
$faq = mysqli_fetch_array(mysqli_query($connect,$query),MYSQLI_ASSOC);//$db_handle->runQuery($query);
if(empty($_GET["rowcount"])) {
$_GET["rowcount"] = mysqli_num_rows(mysqli_query($connect,$sql));//$db_handle->numRows($sql);
}

if($pagination_setting == "prev-next") {
	$perpageresult = $perPage->getPrevNext($_GET["rowcount"], $paginationlink,$pagination_setting);	
} else {
	$perpageresult = $perPage->getAllPageLinks($_GET["rowcount"], $paginationlink,$pagination_setting);	
}

$output = '';
foreach($faq as $k=>$v) {
 /*$output .= '<div class="question"><input type="hidden" id="rowcount" name="rowcount" value="' . $_GET["rowcount"] . '" />' . $faq[$k]["question"] . '</div>';
 $output .= '<div class="answer">' . $faq[$k]["answer"] . '</div>';*/
 
 $output .= "=====".$k;
}
if(!empty($perpageresult)) {
$output .= '<div id="pagination">' . $perpageresult . '</div>';
}
print $output;
?>
