I have a class where I use to get the username, and inside it I have the method:
public function getfName() {
$Session = $_SESSION[$this->Prefix . 'username'];
$sql = "SELECT * FROM " . DB_DBPREFIX . "$this->Table WHERE name = $Session";
try {
$stmt = Conn::dbPrepare($sql);
$stmt->execute();
while ($row = $stmt->fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_NEXT)) {
$data = $row[1];
print $data;
}
} catch (PDOException $e) {
echo $e->getMessage();
}
}
But when I put the $ Session variable in my query I get this error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'TheNight' in 'where clause'
I searched here on Stack and other sites and found a topic but it did not help me, so I decided to open this one!