Handle missing table error gracefully in auth.php
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user