HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-31-18-78 6.17.0-1017-aws #17~24.04.1-Ubuntu SMP Tue May 26 21:09:53 UTC 2026 aarch64
User: ubuntu (1000)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: /var/www/nclive/technc/board_exam_list_data.php
<?php
include 'config.php';
$requestData = $_REQUEST;

$columns = array(
	0 => 'id',
	1 => 'for_class',
	2 => 'state_id',
	3 => 'link',
	4 => 'add_by',
    5 => 'add_date',
    6 => 'status',
    7 => 'entity_text',
	8 => 'action',
	9 => 'display_order',
	10=> 'board',
	11=> 'board_image',
	12=> 'delete'
);

$getDataQuery  = "SELECT be.id, be.for_class, be.link, be.add_date, be.status, u.username, s.state_name, be.entity_text, be.display_order, be.board, be.board_image from sp_board_exam as be Left join sp_admin_login as u on u.id=be.add_by Left join sp_states as s on s.state_id=be.state_id";

$getData=$db->prepare($getDataQuery);
$getData->execute();
$totalFiltered = $getData->rowCount();

$searchTerms = "";
if (!empty($requestData['search']['value'])) {
	$searchTerms .= " WHERE ( be.for_class LIKE '" . $requestData['search']['value'] . "%' ";
	$searchTerms .= " OR be.link LIKE '%" . $requestData['search']['value'] . "%' ";
	$searchTerms .= " OR be.entity_text LIKE '%" . $requestData['search']['value'] . "%' ";
	$searchTerms .= " OR be.board LIKE '%" . $requestData['search']['value'] . "%' ";
	$searchTerms .= " OR be.board_image LIKE '%" . $requestData['search']['value'] . "%' ";
	$searchTerms .= " OR s.state_name LIKE '" . $requestData['search']['value'] . "%' ";
	$searchTerms .= " OR u.username LIKE '" . $requestData['search']['value'] . "%') ";
}

$getDataQuery  = "SELECT be.id, be.for_class, be.link, be.add_date,  be.status, u.username, s.state_name, be.entity_text, be.display_order, be.board, be.board_image from sp_board_exam as be Left join sp_admin_login as u on u.id=be.add_by Left join sp_states as s on s.state_id=be.state_id $searchTerms";

$getData=$db->prepare($getDataQuery);
$getData->execute();
$totalFiltered = $getData->rowCount();

$getDataQuery .= " ORDER BY " . $columns[$requestData['order'][0]['column']] . " " . $requestData['order'][0]['dir'] . "  LIMIT " . $requestData['start'] . ", " . $requestData['length'] . "   ";

$getData=$db->prepare($getDataQuery);
$getData->execute();

$data = array();
$message = "'Do you want to delete this Board Exam ?'";
while ($querydata = $getData->fetch()) {

		$delete = '<a onclick="return confirm('.$message.');" href="board_exam_list.php?action=DEL&del_id='. $querydata['id'] .'"><button title="Delete State Exam Board" class="btn btn-danger"> Delete </button></a>';
        
		$nestedData = array();
		$nestedData["id"] = $querydata['id'];
		$nestedData["for_class"] = $querydata['for_class'];
		$nestedData["state_id"] = $querydata['state_name'];
		$nestedData["link"] = $querydata['link'];
		$nestedData["board"] = $querydata['board'];
		$nestedData["add_by"] = $querydata['username'];
        $nestedData["add_date"] = $querydata['add_date'];
        $nestedData["status"] = $querydata['status'];
        $nestedData["entity_text"] = $querydata['entity_text'];
        $nestedData["display_order"] = $querydata['display_order'];
		$nestedData["action"] = "";
		$nestedData["board_image"] = $querydata['board_image'];
		$nestedData["delete"] = $delete;
		$data[] = $nestedData;
	}

$json_data = array(
	"draw"            => intval($requestData['draw']),
	"recordsTotal"    => intval($totalData),
	"recordsFiltered" => intval($totalFiltered),
	"data"            => $data
);

echo json_encode($json_data);
?>