我试图回显从特定日期( CURDATE() )还剩多少分钟。
我就是这样做的:
public function getTimeLeft($ip)
{
$this->get = $this->pdo->prepare("SELECT DATE_FORMAT(TIMEDIFF(CURDATE(), 'nextVote')); FROM auths WHERE voter_ip = :ip");
$this->get->execute(array(":ip" => $ip));
}
错误:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1582 Incorrect parameter count in the call to native function 'DATE_FORMAT'' in C:\xampp\htdocs\vote\includes\class\Vote.class.php:174 Stack trace: #0 C:\xampp\htdocs\vote\includes\class\Vote.class.php(174): PDOStatement->execute(Array) #1 C:\xampp\htdocs\vote\index.php(644): Vote->getTimeLeft('127.0.0.1') #2 {main} thrown in C:\xampp\htdocs\vote\includes\class\Vote.class.php on line 174
这种语法有什么问题?