I'm trying to take the CustomerID from the SQL select statement and then assign it to a $_SESSION variable i can use later on during the session.
MY CODE:
session_start();
$Username = $request->getParam('Username');
$PassW = $request->getParam('PassW');
$sql = "SELECT CustomerID FROM login WHERE Username= '$Username' AND PassW='$PassW' LIMIT 1";
try{
$db = new db();
$db = $db->connect();
$stmt = $db->query($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if(count($result) == 1){
$_SESSION['Username'] = $Username;
$_SESSION['CustomerID'] = '****CUSTOMER ID FROM TABLE****';
I'm new to this so any help is appreciated :)