From d94a42bb6b9311f7a7a0e71e6b65ae2315281401 Mon Sep 17 00:00:00 2001 From: Nama Kamu Date: Thu, 11 Jun 2026 15:59:27 +0700 Subject: [PATCH] Handle missing table error gracefully in auth.php --- 05/auth.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/05/auth.php b/05/auth.php index c58cb0a..2cb27a4 100644 --- a/05/auth.php +++ b/05/auth.php @@ -13,6 +13,9 @@ if ($aksi === 'login') { $password = $_POST['password'] ?? ''; if (!$email || !$password) json_out(['error'=>'Email dan password wajib diisi'],400); $stmt = $conn->prepare("SELECT u.*,r.nama AS role_nama FROM user u JOIN role r ON u.role_id=r.id WHERE u.email=? AND u.aktif=1 LIMIT 1"); + if (!$stmt) { + json_out(['error' => 'Database error: ' . $conn->error], 500); + } $stmt->bind_param('s',$email); $stmt->execute(); $user = $stmt->get_result()->fetch_assoc();