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/backend/sp_exam_api/create_json_file_for_notification.php
<?php
include "/var/www/nclive/backend/config.php";
$outputFile = __DIR__ . "/notification_data.json";  // File to store JSON

// Run the query
$sql = "SELECT notify.id, notify.title, notify.exam_id, notify.state_id, notify.expiry_date, notify.added_by, notify.status, notify.display_order, notify.add_date,exam.exam_name,exam.url_slug,state.state_name, exam.sp_exam_id FROM sp_notification as notify LEFT JOIN sp_exam as exam on exam.exam_id=notify.exam_id LEFT JOIN sp_states as state on state.state_id=notify.state_id where  CURDATE() <= notify.expiry_date and notify.status='1' and notify.notif_type='Exam' order by notify.display_order desc";

$stmt = $db->query($sql);
$rows = $stmt->fetchAll();

// Organize all data for fast API access
$organized = [];
foreach ($rows as $row) {
    $organized[] = $row;
}

// Save as JSON
file_put_contents($outputFile, json_encode($organized, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));

echo "✅ JSON file generated successfully at: $outputFile\n";