Not new to PHP, but only a day old to PDO. Surely I am doing something wrong here.
$query = $conn->prepare("SELECT * FROM admins WHERE username = :username AND password = :password");
$query->execute(array('username' => $username,'password' => sha1($password)));
$result = $query->fetchAll(PDO::FETCH_ASSOC);
if (count($result) > 0)
{
$_SESSION['user']['who'] = $result[0]['who'];
$_SESSION['user']['email'] = $result[0]['email'];
$_SESSION['user']['username'] = $result[0]['username'];
echo REFRESH;
}
else
{
$message = "Invalid username / password.";
}
the only way I can declare those $_SESSIONS properly is if I use $result[0]['fieldName']; How can I just access it via $result['fieldName']; ?