插入时间()严格标准错误

时间:2012-12-26 19:19:18

标签: php sql pdo

我想插入用户注册的时间:

function InsertUserToSql()  
...
$stmt = $this->dbh->prepare("INSERT INTO users 
(username, password, email, regdate) VALUES 
(:username,:password, :email, :regdate)");

        $stmt->bindParam(':username', $this->Username);
        $stmt->bindParam(':password', $this->Password);
        $stmt->bindParam(':email', $this->Email);
        $stmt->bindParam(':regdate', time());  // this line shows the error
        $stmt->execute();
...

错误:Strict standards: Only variables should be passed by reference

1 个答案:

答案 0 :(得分:1)

$stmt = $this->dbh->prepare("INSERT INTO users 
(username, password, email, regdate) VALUES 
(:username,:password, :email, UNIX_TIMESTAMP())");

至于错误信息 - 它非常好看。