database->prepare("SELECT * FROM server_account WHERE entity_id = ?"); $stmt->bind_param('d', $entity_id); $stmt->execute(); $result = $stmt->get_result(); if($row = $result->fetch_assoc()) { $account = new ServerAccount($row['entity_id'], $row); } else { throw new ServerAccountNotFoundException('Server account does not exist.'); } $stmt->close(); return $account; } } class ServerAccountNotFoundException extends Exception {} class ServerAccountNotDeletableException extends Exception {}