我有這個問題,我無法使用PHP作爲服務器端腳本語言將記錄從oracle數據庫顯示到我的web應用程序。有人請告訴我我可能做錯的地方嗎?我希望在一天結束時能夠實現分頁,並用用戶在從一頁頁面移動到另一頁面時可以操作的變量替換ROWNUM和rnum。我在哪裏可以在這個PHP ORACLE分頁腳本中做錯?
<?php
/* Connection string to Oracle view */
/* user is patients */
/* password is patients */
$conn=oci_connect('patients','patients','192.168.1.100/hosecare');
/* Query expected to do pagination and get records */
$qry="select *
from (select a.*, ROWNUM rnum
from (select BILL_NO,AK_NO,PAT_NAME,VOUCHER_DATE,USER_NAME,PAYMENT_AMT from patients WHERE VOUCHER_DATE >='01-Sep-2011' AND VOUCHER_DATE <='26-Sep-2011' AND SOURCE_LOCATION='KIAMBU CLINIC' ORDER BY VOUCHER_DATE)a
where ROWNUM <=20)
where rnum >=10;";
$stid=oci_parse($conn,$qry);
oci_execute($stid);
/* Table begins here */
echo "<table border='1'>\n";
echo "<tr>\n";
/* Table Column headers */
echo "<td>".'<h3>BILL NO</h3>'."</td>";
echo "<td>".'<h3>ACCOUNT NO</h3>'."</td>";
echo "<td>".'<h3>PATIENT NAME</h3>'."</td>";
echo "<td>".'<h3>VOUCHER DATE</h3>'."</td>";
echo "<td>".'<h3>USER NAME</h3>'."</td>";
echo "<td>".'<h3>PAYMENT AMOUNT</h3>'."</td>";
echo "</tr>\n";
/* Populating Table cells with records resulting from the pagination query */
while($row=oci_fetch_array($stid,OCI_ASSOC+OCI_RETURN_NULLS)) {
echo "<tr>\n";
foreach($row as $item){
echo "<td>".($item !==null ? htmlentities($item,ENT_QUOTES) : " ")." </td>\n";
}
echo "</tr>\n";
}
echo "</table>\n";
?>
什麼是實際問題。錯誤或沒有數據返回。 – Sodved
沒有數據返回。 –