query("SELECT staff_idno, staff_id FROM staff WHERE staff_id != ''"); if ($mysqli_staff->num_rows > 0){ while($row_staff = $mysqli_staff->fetch_array(MYSQLI_ASSOC)){ $staff_all[$row_staff['staff_idno']] = $row_staff['staff_id']; } } $search_name = $_GET['search_name']; $search_date = $_GET['search_date']; if ( $search_date != '' ){ $search_query .= " AND ( a.created_at LIKE '%".$search_date."%' )" ; } if ( $search_name != '' ){ $search_query .= " AND ( b.staff_name LIKE '%".$search_name."%' )" ; } // page query $mysqli_query = "SELECT a.created_at, a.balance, a.before_amount, a.amount, b.staff_name FROM staff_point_movement a LEFT JOIN staff b ON (a.staff_id = b.staff_id) WHERE a.deleted_at IS NULL " . $search_query .$user_branch_permission_sql_b ; // pagination if (isset($page) && !empty($page)) { $product_page = $page ; } else { $product_page = 1 ; } // next and prev page (5 thing need to change) $start_from = ($product_page - 1) * LIMIT ; //end next and prev page // set search url $search_url = 'search='.$search.'&search_name='.$search_name.'&search_date='.$search_date.'&page_mode=staff-point-history' ; $mysqli_page = $mysqli->query($mysqli_query."ORDER by a.staff_id, a.movement_id DESC LIMIT $start_from, " . LIMIT) ; // load pagination $page_pagination = nextPrevious($product_page, LIMIT, $search_url, $mysqli_query) ; include 'requires/page_header.php'; include 'requires/page_top.php'; ?>