This is the code i use to login a user, i want to get the id number of the user and echo it into $_SESSION['Teacher'] to use later on, i thought you could do it using $row['id'], but it seems not.. any help is appreciated.
public function verifyLogin($username, $password){
// this function checks whether the user name exists and if its a match
if(!empty($username) && !empty($password)){
$st = $this->db->prepare("SELECT * FROM teachers WHERE username=? AND password=?");
$st->bindParam(1, $username);
$st->bindParam(2, $password);
$st->execute();
if ($st->rowCount() == 1){
session_start();
$_SESSION['Teacher'] = $row['id'];
header("Location: dashboard.php");
} else {
header("Location: login.php?incorrect");
}
}
}