所以我有这个问题,
$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";
关于php - Mysql 查询不通过 JSON 发送响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33075020/