我被困在如何为登录的用户创建会话。我得到了检查以确保登录信息与数据库信息一致的部分,但被困在如何获取电子邮件地址并将其存储到会议。下面是我的 php 代码。
<?php include '../View/header.php';
session_start();
require('../model/database.php');
$email = $_POST['username'];
$password = $_POST['password'];
$sql = "SELECT emailAddress FROM customers WHERE emailAddress ='$email' AND password = '$password'";
$result = mysql_query($sql, $db);
if (!$result) {
echo "DB Error, could not query the database\n";
echo 'MySQL Error: ' . mysql_error();
exit;
}
while ($row = mysql_fetch_assoc($result)) {
echo $row['emailAddress'];
}
mysql_free_result($result);
?>