所以我有这个查询,
$sql="SELECT c.first_name, a.id, a.name, a.current_value,a.end_date from psf_customer c,
psf_auctions a join psf_customer_bids b ON a.id=b.auction_id where c.user_id =b.user_id
and TIMESTAMP (b.timestamp, '00:00:02') >= '$now' order by b.timestamp DESC";
$now
这是一个具有以下日期的变量,(当前日期)
$now = date('Y-m-d H:i:s');
正在通过
执行 $bids = $this->Db->addSQL($sql)->execute()->fetchArray();
并发送回复
return json_encode($bids);
但是当我试图得到回应时,
var data = JSON.parse(d);
console.log(data);
这个控制台什么都不打印,查询在数据库上运行正常。我怀疑变量$now
需要以某种方式改变吗?
答案 0 :(得分:0)
试试这个:
$sql="SELECT c.first_name, a.id, a.name, a.current_value,a.end_date from psf_customer c,
psf_auctions a join psf_customer_bids b ON a.id=b.auction_id where c.user_id =b.user_id
and TIMESTAMP (b.timestamp, '00:00:02') >= now() order by b.timestamp DESC";