I am using the following code to retrieve records from a table:
$conn = ......
$query="select * from the_table"
$stmt = ociparse($conn,$query);
OCIExecute($stmt);
if (!OCIFetch($stmt)) {
print "no record available";
}else {
print "Here are the records.<br>";
// OCIExecute($stmt);
while (OCIFetch($stmt)) {
.....
}
}
However, if there are 10 records in the table, only 9 will be displayed. This is because after " if (!OCIFetch($stmt)) " is evaluated, the pointer is pointing to the record after the first one.
One trick is to use "OCIExecute($stmt); " twice, as I commented out above. But I doubt this is the most effective way. In JSP, there is such function as resultSet.next(), resultSet.beforeFirst(). Is there any similar function in PHP with Oracle?
Please help.
Thanks.
Jie Huang