我有这个sql查询选择计数(n.msisdn)FULL_KYC,decile_group
来自表1
我在这里得到的结果是数字(FULL_KYC)和十分位数组(从十分位数1到十分位数10)。我需要能够将这些结果添加到php中的一个表中,其中包括每列总数的新行。我正在使用oracle数据库并进行远程连接。非常感谢
简单的答案是,您需要一个具有php和oracle php扩展的web服务器。然后,您可以使用Php的oracle连接器并启动查询、检索数据并用html表显示它们。
以下是一个示例:http://php.net/manual/en/oci8.examples.php.
再见
为了完成完整的请求,您可以更改
print "<table border='1'>'n";
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
print "<tr>'n";
foreach ($row as $item) {
print " <td>" . ($item !== null ? htmlentities($item, ENT_QUOTES) : " ") . "</td>'n";
}
print "</tr>'n";
}
print "</table>'n";
在中
print "<table border='1'>'n";
$finalRow = array();
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
print "<tr>'n";
foreach ($row as $key => $item) {
$finalRow[$key] = (isset($finalRow[$key]) ? $finalRow[$key] : 0) + $item;
print " <td>" . ($item !== null ? htmlentities($item, ENT_QUOTES) : " ") . "</td>'n";
}
print "</tr>'n";
}
print "<tr>'n";
foreach ($finalRow as $item) {
print " <td>" . ($item !== null ? htmlentities($item, ENT_QUOTES) : " ") . "</td>'n";
}
print "</tr>'n";
print "</table>'n";