RE: [PHP-WIN] Oracle connection, tired eyes
| From: | Asendorf, John | Date: | Fri, 20 Oct 2000 14:42:07 +0000 |
| Subject: | RE: [PHP-WIN] Oracle connection, tired eyes | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-3415@lists.php.net to get a copy of this message | ||
It worked, but I had to change the field name to all caps. I remembered
reading something about that in the manual last night. I was getting 10
"<br />"'s but no 400s... so I changed it to caps and it works. Thanks, I
understand this much better now. I search php.net, zend.com, weberdev, and
phpbuilder and couldn't find this type of help. Looks like it's article
time Andy :)
Thanks, John
---------------------
John Asendorf - jasendorf@lcounty.com
Web Applications Developer
http://www.lcounty.com - NEW FEATURES ADDED DAILY!
Licking County, Ohio, USA
740-349-3631
> -----Original Message-----
> From: Andy Hoffman [mailto:andy.hoffman@bms.com]
> Sent: Friday, October 20, 2000 10:24 AM
> To: php-windows@lists.php.net
> Subject: Re: [PHP-WIN] Oracle connection, tired eyes
>
>
> "Asendorf, John" wrote:
>
> > $sql = "select page from cfull2.resolution where page like 400";
> > $stmt = OCIParse($conn,$sql);
> > $ora_result = OCIExecute($stmt);
> >
> > while (OCIFetch($ora_result)) { //line 42
> > $page = OCIresult ($ora_result, "page");
> > echo "$page <br />";
> > }
> >
> > Anyone?
>
> OK, you have to understand that Oracle callse are NOT
> completely analagous to
> ODBC or mySQL... in other dbs, when you execute the
> statement, the return value
> is what you'd term a "recordset"... however, OCI doesn't work
> that way...
>
> When you call ociparse(), the returned result of that call is
> what would be
> termed your statement handle, and it is this statement handle
> which will
> contain the results of the execution, NOT the result of the
> function call
> itself :)
>
> Thus to accomplish what you want, try this...
>
> <?php
> $sql = "select page from cfull2.resolution where page like 400";
> $stmt = OCIParse($conn,$sql);
> // $stmt now contains a statement handle which is ready to
> execute (prepped)
>
> OCIExecute($stmt, OCI_DEFAULT);
> // $stmt now contains a statement handle which POINTS to a recordset
> // OCI_DEFAULT denotes default cursor type
>
> while (OCIFetchInto($stmt, $row, OCI_ASSOC)) {
> // FetchInto fetches directly into a record array and
> // OCI_ASSOC makes that array associative by the
> field names
> $page = $row[page];
> echo "$page <br />";
> }
> ?>
>
> --
> Andy Hoffman
> Web Developer
> Bristol-Myers Squibb
> email: andy.hoffman@bms.com
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> For additional commands, e-mail: php-windows-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>