<?php
// Koneksi ke database
$servername = "localhost";
$username = "zonb9946_weliington";
$password = "#Bismillah16";
$dbname = "zonb9946_email";

$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// Ambil data dari tabel tbl_securitymail
$sql = "SELECT NIK, NM, EMAIL, DIV FROM tbl_securitymail";
$result = $conn->query($sql);

$data = array();
if ($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
        $data[] = $row;
    }
}

$conn->close();

echo json_encode($data);
?>
