diff --git a/threadr/userhome/index.php b/threadr/userhome/index.php index 6ac99cd..f37bff6 100644 --- a/threadr/userhome/index.php +++ b/threadr/userhome/index.php @@ -1,15 +1,22 @@ prepare('SELECT name FROM users WHERE id = :user_id;'); // to be replaced with optional user name off the user data table -$result = $statement->execute(array('user_id' => $_SESSION['user_id'])); -$dbentry = $statement->fetch(); -$username = $dbentry['name']; +$error = false; +$error_message = ""; +if (!$error) { + $statement = $pdo->prepare("SELECT name FROM users WHERE id=:uid"); // to be replaced with optional user name off the user data table + $statement->execute(array("uid"=>$_SESSION[user_id])); + $dbentry = $statement->fetch(); + $username = $dbentry[name]; +} +if (!$result) { + $error_message = "Error: SQL error.\n" . $statement->queryString . "\n" . $statement->errorInfo()[2]; +} $navbar = "home"; //ToDo: differentiate between home and userhome (or auto-redirect) @@ -23,13 +30,13 @@ $navbar = "home"; - %NAVBAR% -
-
-

ThreadR

+ %NAVBAR% +
+
+

ThreadR

+
+
+

+
-
-

-
-
- +