所以这一直推动我坚果的最后两小时日期字段...PHP - 使用PDO与不工作
$sql = 'SELECT * FROM master_rets_table
WHERE listing_entry_timestamp > "2014-04-01 00:00:00"
ORDER BY listing_price DESC';
}
$this->stm = $this->prepare($sql);
$this->stm->execute();
运行PDO超出此查询在Navicat工作正常(我得到17条记录) ,但无论我如何改变这种情况,它都不适用于PDO。我使用相同的代码来处理大量不使用日期约束的PDO查询,并且它们都可以很好地工作。
仅供参考,listing_entry_timestamp是DateTime字段
编辑 - 这里是整个代码块
if ($this->city != "") {
$sql = 'SELECT * FROM master_rets_table
WHERE city = '.$this->city.'
ORDER BY listing_price DESC';
}
else if ($this->subdiv != ""){
$sql = 'SELECT * FROM master_rets_table
WHERE subdivision REGEXP '.$this->subdiv.'
ORDER BY listing_price DESC';
}
else if ($this->date_from != "") {
$sql = "SELECT * FROM master_rets_table WHERE (listing_entry_timestamp > '2014-04-01') ORDER BY listing_price DESC";
}
$this->stm = $this->prepare($sql);
$this->stm->execute();
$this->rows= $this->stm->fetchAll(PDO::FETCH_ASSOC);
$this->count = $this->stm->rowCount();
$this->rowIdx = 0;
它的另外两起案件工作正常...它看起来好像是做日期时间字段什么的。
编辑[解决方案] - 事实证明,实时数据没有被推送到开发服务器,我在Navicat中对实时数据进行了测试,因此查找昨天数据的查询找不到任何东西。
定义“不工作”。你会取得结果吗? –
@你不工作=没有结果和$这是我设计的扩展PDO类,适用于很多不使用日期的查询。 – menriquez
你会友善并为我们提供表格模式吗? – ROLO