prepare("INSERT INTO Users (Users_username, Users_password, Users_admin) VALUES (:username, :password, :admin)"); $stmt->bindParam(":username", $username); $stmt->bindParam(":password", $password); $isAdmin = $admin ? 1 : 0; $stmt->bindParam(":admin", $isAdmin); $stmt->execute(); echo json_encode(array("message" => "ok", "admin" => $admin)); } else if (isset($_SESSION["username"]) && !isset($_SESSION["admin"])) { echo json_encode(array("message" => "not logged in as admin")); } else { echo json_encode(array("message" => "Not logged in ")); }