我有以下代码:它的目的非常明确=>在登录更新数据库时使用+1登录为totallogins并记录最后一次登录的时间。唯一的缺点是它不会工作。
<?php
date_default_timezone_set('Europe/Amsterdam');
if (isset($_POST['formsubmitted'])) {
$Timesloggedin = "SELECT * FROM members.Timesloggedin WHERE Email='$email'";
$time = date("Y-m-d H:i:s");
$query1 = "UPDATE members SET Timesloggedin = $Timesloggedin + 1, Lastloggedin = $time WHERE Email ='$email'";
$result_insert_loggedins = mysql_query($query1);
if (!$result_insert_loggedins) {
echo 'Query failed';
}
if (mysql_affected_rows($dbc) == 1)
{
//If the Insert Query was successfull.
}
?>