$argUser - MySQL 设置为 VARCHAR(15)。
如果我寄信,一切都会正常。
如果我发布字母和数字,一切正常。
如果我只发布数字...它不会记录该条目...
我正在使用 CodeIgniter 框架,这是我用于记录登录尝试的函数:
function testCredentials($row, $argUser) {
$this->log_attempt = $argUser;
$this->log_time = date("Y-m-d h:i:s");
$this->log_ip = $_SERVER['REMOTE_ADDR'];
if ($row->user_regid == $argUser) {
$this->log_success = 'TRUE';
$this->db->insert('logins', $this);
return TRUE;
} else {
$this->log_success = 'FALSE';
$this->db->insert('logins', $this);
return FALSE;
}
}
最佳答案
不要使用 varchar 来存储日期和时间。
你可以使用MySql datetime数据类型来存储php日期(date("Y-m-d h:i:s");)
关于php - MySQL Varchar 不只记录整数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28634200/