0

I want to insert the time of user's registration:

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();
...

Error: Strict standards: Only variables should be passed by reference

Alegro
  • 7,534
  • 17
  • 53
  • 74
  • http://stackoverflow.com/questions/2354609/strict-standards-only-variables-should-be-passed-by-reference – Glavić Dec 26 '12 at 19:30

1 Answers1

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

as for the error message - it's pretty googlable.

Your Common Sense
  • 156,878
  • 40
  • 214
  • 345
  • Yeah, it's easy googlable - over 1000 results, but is's pretty hard to find `time()` version of the error and the correct answer. Thanks a lot. Solved. – Alegro Dec 26 '12 at 19:27