Date: 10/15/01
- Next message: Jon Haworth: "RE: [PHP] Dynamic Forms"
- Previous message: DL Neil: "Re: [PHP] MySQL resource"
- Maybe in reply to: J. Anderson Scarbrough: "[PHP] Oracle query with one returned record"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
if (!OCIFetchInto($curs,$data)))
{
// not found
}
else
{
$companyname = $data[0];
$companyaddress = $data[1];
$companyaddress2 = $data[2];
$companycity = $data[3];
$companystate = ucwords($data[4]);
$companypostalcode = $data[5];
$companycountry = ucwords($data[6]);
}
-----Original Message-----
From: J. Anderson Scarbrough [mailto:jebscarbrough <email protected>]
Sent: 15 October 2001 14:57
To: php-general <email protected>
Subject: [PHP] Oracle query with one returned record
When I have an oracle procedure that returns one and only one row i still
find myself looping through the cursor to get the results. is there a
better way to accomplish this without writing a loop when you know the loop
will only execute once? (code below)
Thanks.
query = "begin pkg.procedure($id, :curs, :errorCode); end;";
//query should return only the details of the $id passed in to proc.
$curs = OCINewCursor($connection);
$stmt = OCIParse ($connection, $query);
OCIBindByName ( $stmt, ":curs", &$curs,-1,OCI_B_CURSOR);
OCIBindByName ($stmt, ":errorCode", &$errorCode,10);
$result = OCIExecute ($stmt);
$result = OCIExecute ($curs);
while (OCIFetchInto($curs,$data)) {
$companyname = $data[0];
$companyaddress = $data[1];
$companyaddress2 = $data[2];
$companycity = $data[3];
$companystate = ucwords($data[4]);
$companypostalcode = $data[5];
$companycountry = ucwords($data[6]);
}
OCIFreeStatement($stmt);
OCIFreeCursor($curs);
?>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Jon Haworth: "RE: [PHP] Dynamic Forms"
- Previous message: DL Neil: "Re: [PHP] MySQL resource"
- Maybe in reply to: J. Anderson Scarbrough: "[PHP] Oracle query with one returned record"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

