为什么没有更新mysql日期字段?
$st = $this->db->prepare("update users set ipaddress=? and
lastlogin=? where email=?");
$mysqldate = date('Y-m-d');
$st->execute(array($ip_address, $mysqldate, $email));
答案 0 :(得分:2)
尝试不使用“和”,这在更新时是不正确的:
$st = $this->db->prepare("update users set ipaddress=?, lastlogin=? where email=?");
见这里:http://dev.mysql.com/doc/refman/5.1/en/update.html
除此之外,你可以使用mysql时间函数,例如 CURDATE()来实现你的结果:https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_curdate