Why is the mysql date field not being updated?
$st = $this->db->prepare("update users set ipaddress=? and
lastlogin=? where email=?");
$mysqldate = date('Y-m-d');
$st->execute(array($ip_address, $mysqldate, $email));
Try without the "and" which is incorrect in case of updating:
$st = $this->db->prepare("update users set ipaddress=?, lastlogin=? where email=?");
See here: http://dev.mysql.com/doc/refman/5.1/en/update.html
Other than that, you could use the mysql time functions, for example CURDATE() to achieve your result: https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_curdate
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.