Try the oci8 extension in php and the phpoci8 extension _ PHP Tutorial

Source: Internet
Author: User
Try the oci8 extension in php and the phpoci8 extension. Try the oci8 extension in php and use the phpoci8 extension to share with you the Operation class Oracle_db.class.phpphpclassOracle_db {public $ link; publicfunction _ construct () {$ thi try the oci8 extension in php, try phpoci8 extension

I would like to share with you a php operation class on Oracle.

Oracle_db.class.php

<? Phpclass Oracle_db {public $ link; public function _ construct () {$ this-> link = $ this-> connect (); if (! $ This-> link) {echo "connection failed"; exit ;}} public function connect () {return oci_connect ('demo', 'demo', 'localhost/xe ', 'al32utf8');} public function execute ($ SQL) {$ result = false; $ stid = oci_parse ($ this-> link, $ SQL); if ($ stid) {$ result = oci_execute ($ stid);} return array ($ stid, $ result);} public function fetch_assoc ($ stid) {return oci_fetch_assoc ($ stid );} public function fetch_one ($ stid) {$ arr = $ this-> fetch_assoc ($ stid); $ this-> free ($ stid); return $ arr ;} public function fetch_all ($ stid) {$ arr = array (); while ($ row = $ this-> fetch_assoc ($ stid) {$ arr [] = $ row ;} $ this-> free ($ stid); return $ arr;} public function num_rows ($ stmt) {return oci_num_rows ($ stmt);} public function error () {return oci_error ($ this-> link);} public function free ($ stid) {return oci_free_statement ($ stid);} public function server_version () {return oci_server_version ($ this-> link);} public function client_version () {return oci_client_version ();} public function _ destruct () {return oci_close ($ this-> link );}//}

The above is all the content of this article. I hope you will like it.

Tips: I will share with you a php Oracle operation class Oracle_db.class.php phpclass Oracle_db {public $ link; public function _ construct () {$ thi...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.