unexpected T_CATCH, expecting T_FUNCTION

Frks

New Member
Today, while trying to write this User class, I ran into the above error on the highlighted line below, and was wondering what you lot thought of it.\[code\]class User { public $username; public $password; public $user_info; public $connection; function __construct($username) { $connection = new Database(); try { $user_info = $connection->query("SELECT * FROM `users` WHERE `username` = '$username'"); if ($user_info == null) { throw new Exception("Could not find user details, please try again later!"); } ***} catch (Exception $login) {*** die($login->getMessage()); } session_start(); $_SESSION["dgs_tech"] = $user_info; } function update_info() { $user_info = $connection->query("SELECT * FROM `users` WHERE `username` = '$username'"); if ($user_info == null) { throw new Exception("Could not find user details, please try again later!"); } } catch (Exception $login) { die($login->getMessage()); } $_SESSION{"dgs_tech"] = $user_info; } function return_info() { $text = "<p>" foreach($user_info as $name => $item) { $text += "<h1>$name:</h1>$item<br/>"; } $text += "</p>"; return $text; } }\[/code\]
 
Back
Top