我有一个时间表数据库,志愿者可以在其中检查他们的班次。我将通过电子邮件向他们发送一个链接,该链接指向他们将电子邮件地址输入 HTML 表单以访问此信息的页面。
有没有办法可以跟踪查询了哪些电子邮件,以便我可以将计划链接重新发送给尚未访问数据库的人?
如有必要,我可以在结果中添加一个额外的“已确认”复选框并让它更新数据库。我喜欢这个想法,但我不确定如何实施(或该操作的术语)。
编辑:这是我用来实现的代码。但是,我没有在已确认的列中得到结果。
$db = new mysqli("host", "user", "pass", "db");
$stmt = $db->prepare('UPDATE volConfirm SET confirmed = TRUE WHERE email = ?');
$stmt->bind_param('s', $_POST['email']);
$stmt->execute();
$stmt = $db->prepare('SELECT * from volConfirm WHERE email = ?');
$stmt->bind_param('s', $_POST['email']);
$result = $stmt->get_result();
while ($row = $result->fetch_array(MYSQLI_NUM)) {
// construct your output here using $row to access database record
echo "<h2>" . $row['agreeName'] . "</h2>";
echo "<p> You have been assigned as a volunteer for:" . $row['position'] . "</p>";
echo "<p>Your shift times are scheduled for:" . $row['shift_times'] . "</p>";
echo "<p>Your shift has been confirmed:" . $row['confirmed'] . "</p>";
}