RE: [PHP] OCIFetchInto: OCI8 problem
| From: | Faisal Abdullah | Date: | Mon, 14 Oct 2002 07:15:19 +0000 |
| Subject: | RE: [PHP] OCIFetchInto: OCI8 problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-119842@lists.php.net to get a copy of this message | ||
I added a little $counter in the while loop.
The count shows 2.
But why do I only get one value?
Thanks,
Faisal
-----Original Message-----
From: Faisal Abdullah [mailto:faisal@magnifix.com.my]
Sent: Monday, October 14, 2002 9:55 AM
To: php-general@lists.php.net
Subject: [PHP] OCIFetchInto: OCI8 problem
Hi ppl.
I have something which seems really odd.
I run a SQL query, which is supposed to return 2 rows, but instead, it
returns one with
OCIFetchInto(). I used the exact same query in SQL*Plus, and It returns 2
rows like I want them.
Here's the code.
if(!$iDBConn = OCILogon(DB_USER, DB_PASS, DB_NAME))
echo "Failed to connect to Oracle database<br>";
$stmt = OCIParse($iDBConn,"ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD'");
OCIExecute($stmt,OCI_DEFAULT);
$orasql = "SELECT * FROM gaj_ledjer_potongan WHERE no_gaji =
'".$id["salary_no"].
"' AND kod_potongan = '09' AND tempoh_gaji LIKE '$year%'";
echo $orasql."<br>";
$iStatement = @OCIParse($iDBConn, $orasql);
@OCIExecute($iStatement, OCI_DEFAULT);
$arrError = OCIError($iStatement);
if ($arrError['code']) {
print $arrError['message'];
exit;
}
$total_ded_sal = 0;
$deduction = $id["deduction"];
while(OCIFetchInto($iStatement, &$ora, OCI_ASSOC+OCI_RETURN_NULLS)) {
echo $ora['TEMPOH_GAJI']."<br>";
}
p/s - I tried using a select * from table, and it returns more than one
rows(i suppose all the rows).
Thanks.
______________________________________
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
______________________________________