sql_query("UPDATE `notification_list` SET `status`= 1 WHERE `notification_type_id` = '$notification_type_id' AND `employee_id` = '$employee_id' "); $notification_total_count = $db -> select("SELECT count(id) FROM `notification_list` WHERE `employee_id` = '$employee_id' AND `status` != '1'"); $return_arr['count'] = ""; $return_arr['sub_count'] = "0"; $return_arr['data'] = ""; if($notification_total_count > 0){ $return_arr['count'] = $notification_total_count; $return_arr['sub_count'] = $notification_total_count; } $notification_list = $db -> sql_query("SELECT nl.description,nt.link,nl.record_id,nl.employee_id,nl.generate_by_employee_id, DATE_FORMAT(`date_time`,'%M %d, %Y - %h:%m %p') as date_time FROM `notification_list` nl INNER JOIN notification_type nt ON nt.id = nl.`notification_type_id` WHERE nl.`employee_id` = '$employee_id' AND nl.status = 0 ORDER BY nl.date_time DESC LIMIT 5"); // foreach($notification_list as $data){ // if($notification_total_count < 1){ // break; // } // $link = $data['link']; // $data = $data['data']; // $return_arr['data'] = " // // $data // // // "; // } foreach($notification_list as $data){ if($notification_total_count < 1){ break; } $header_date_time = $data['date_time']; $header_record_id = $data['record_id']; $header_employee_id = $data['employee_id']; $header_generate_by_employee_id = $data['generate_by_employee_id']; $header_description = $data['description']; $header_link = $data['link'].$db -> base64_url_encode( '{"record_id":"'.$header_record_id.'","generate_by_employee_id":"'.$header_generate_by_employee_id.'","employee_id":"'.$header_employee_id.'"}' ); $return_arr['data'] = $return_arr['data'] . "

$header_date_time

"; } echo json_encode($return_arr); ?>