prepare("SELECT id FROM users WHERE username = ? OR email = ?"); $stmt->execute([$username, $email]); if ($stmt->fetch()) { $error = "Username or email already exists"; } else { // Register user $hash = password_hash($password, PASSWORD_DEFAULT); $stmt = $pdo->prepare("INSERT INTO users (username, email, password, role) VALUES (?, ?, ?, 'Customer')"); try { $stmt->execute([$username, $email, $hash]); $success = "Registration successful!"; } catch (PDOException $e) { $error = "Registration failed: " . $e->getMessage(); } } } } ?>