<?php
/*
* date last modified 28-11-2017
* Edited by PI-Digi Logical Solutions
* HTML Files - add_user.html.php
* Mysql Tables - tbl_designation, tbl_user
*/
include('includes/imgFunctions.php');
include('includes/functions.php'); # general functions
require_once('./classes/class.noseo_pagination.php'); # pagination class

if(isset($_REQUEST['p']) && $_REQUEST['p']!=''){
	$p = trim($_REQUEST['p']);
} else {
	$p = 1;
}


if(isset($_REQUEST['id']) && $_REQUEST['id']!=''){		
	$editId = mysqli_real_escape_string($con, trim($_REQUEST['id']));	
	//delete image
	/*if(isset($_REQUEST['action']) && $_REQUEST['action']='del_image'){
		$recImg = mysqli_fetch_array(mysqli_query($con, "SELECT image FROM tbl_purchase_partner WHERE id = '".$editId."'"));
		if(($recImg['image']!='') && file_exists(STAFF_IMG_FOLDER.$recImg['image'])){
			unlink(STAFF_IMG_FOLDER.$recImg['image']);
			unlink(STAFF_IMG_FOLDER.'thumb/'.$recImg['image']);
		}
		$update = mysqli_query($con, "UPDATE tbl_purchase_partner SET image = '' WHERE id = '".$editId."'");
		$success = 'Staff image has been deleted';
	}*/	
	
	$editRs = mysqli_query($con, "SELECT * FROM tbl_purchase_partner WHERE id = '".$editId."'");
	if(mysqli_num_rows($editRs)>0){
		$resEdit = mysqli_fetch_array($editRs);
		
		
		//get payments
		$select = "SELECT * FROM tbl_shop_paid WHERE shop_id = '".$editId."'";
		// Using pagination class
		$pagination = new pagination_noseo($select);
		$execDetails = $pagination->createPages(30);		
		$pageLnk = 'index.php?page='.$page.'&'.$pageVars;
		$pageNums = $pagination->pageNumber(5, $pageLnk);
		
		
		
	} else {
		$error = 'Shop does not exist!';
	}

} 


?>