OCIFetchInto: OCI8 problem

From: Date: Mon, 14 Oct 2002 01:55:17 +0000
Subject: OCIFetchInto: OCI8 problem
Groups: php.general 
Request: Send a blank email to php-general+get-119825@lists.php.net to get a copy of this message
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. ______________________________________

« previous php.general (#119825) next »