prepare(' SELECT SecureToken.Id, SecureToken.UserId, SecureToken.Value FROM SecureToken WHERE SecureToken.Id = :userid '); $pdoQuery->execute([ ':userid' => (int) $_REQUEST['userid'] ]); foreach($pdoQuery->fetchAll(PDO::FETCH_ASSOC) as $row) { //bla } // Return JSON object header('Content-Type: application/json'); echo json_encode([ "Result" => "Success", "UserSessions" => json_encode( $moo ) ]); } else { // No action requested, default action include_once('../include/lucidAuth.template.php'); try { $allUsers = $pdoDB->query(' SELECT User.Id, User.Username, Role.Rolename FROM User LEFT JOIN Role ON (Role.Id = User.RoleId) ')->fetchAll(PDO::FETCH_ASSOC); } catch (Exception $e) { // Should really do some actual errorhandling here throw new Exception($e); } foreach($allUsers as $row) { $tableRows[] = sprintf('