我正在开发一个页面,用户可以在该页面上选择通过 ZIP 文件下载哪些过期发票。我正在更改现有查询以仅提取那些已由用户检查的发票,其中作业 ID 号通过数组发送到 PHP 函数。
下载所有发票的现有查询是:
$sql = '
select i.jobid
from invoice i
join job j
on j.id = i.jobid
where i.total > 0
';
$Q = $this->read_db->query($sql, array($days));
$days 是显示发票的天数。
我已将其更改为:
$ids = implode(',', $invids); // $invids is the array sent in of invoice numbers
$sql = 'select `i`.`jobid` from `invoice` `i` WHERE `i`.`jobid` IN ' . $ids . ' join `job` `j` on `j`.`id` = `i`.`jobid` where `i`.`total` > 0 ';
$Q = $this->read_db->query($sql, array($days));
当我尝试回显 $Q->result() 时,我得到一个错误Call to a member function result() on boolean。我对 mySQL 相当陌生,因此非常感谢任何帮助。
守着星空守着你