我正在尝试用ctime
今天的 a 来获取任何记录。对于某些原因,&tomorrow 和 &yesterday 没有任何值。如果我删除strtotime()
它们的值是从mktime
. 我在做什么错strtotime
?
PHP:
public function fetchToday()
{
$tomorrow = strtotime(mktime(0, 0, 0, date("m") , date("d")+1, date("Y")));
$yesterday = strtotime(mktime(0, 0, 0, date("m") , date("d")-1, date("Y")));
$q = "SELECT * FROM $this->_table WHERE ctime < $tomorrow AND ctime > $yesterday";
return $this->fetchBySelect($q);
}
错误:
ModelFactory - 'ERROR: syntax error at or near "AND"
LINE 1: SELECT * FROM motd WHERE ctime < AND ctime >
PostrgeSQL 表字段:
ctime timestamp(0) with time zone
询问:
SELECT * FROM motd WHERE ctime < 1372402800 AND ctime > 1372230000;
`