User.php
<?php
class User {
public static $Row = [];
public static function Check() {
global $PDO;
$usersql = $PDO->prepare("SELECT * FROM users WHERE username = :username AND password = :password LIMIT 1");
$usersql->execute(array(':username' => $_SESSION['username'], ':password' => $_SESSION['password']));
$Row = $usersql->fetch(PDO::FETCH_ASSOC);
self::$Row = $Row;
}
}
Index.php
echo 'Você é '. User::$Row['username'];
And error that gives:
Notice: Undefined index: username in C: \ xampp \ htdocs \ Index.php on line 1
It appears in index.php
in Check()
, when I try to call user information it gives this error.
Does anyone know how to solve it?