[英]Mysql query doesnt send response via JSON
所以我有这个查询,
$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
需要以某种方式更改?
尝试这个:
$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";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.