我创建了一个用于显示报告的查询。该查询从几个不同的表中获取数据,这很好,尽管我无法弄清楚如何在一个表中回显多个匹配值。例如,表 vtiger_addisa 有多个我需要显示的 newcurrentamount。
$sql = $adb->query("SELECT *
FROM vtiger_isa, vtiger_addisa, vtiger_contactdetails
WHERE vtiger_isa.relatedclient = vtiger_addisa.addrelatedclient
AND vtiger_addisa.addrelatedclient = vtiger_contactdetails.contactid
AND vtiger_isa.relatedclient = $relatedclient
AND vtiger_isa.policynumber = $policynumber");
//Uncomment lines below for testing sql
//echo $sql;
//exit;
while ($sql->fetchInto($row)) {
// Assuming DB's default fetchmode is DB_FETCHMODE_ORDERED
echo $row['firstname'] . "\n";
echo $row['lastname'] . "\n";
echo $row['policynumber'] . "\n";
echo $row['newcurrentamount'] . "\n";
echo $row['newcurrentamount'] . "\n";
echo $row['currentamount'] . "\n";
exit;
}