Sample code for connecting php to the oracle database

Source: Internet
Author: User
Sample code for connecting php to the oracle database

  1. If ($ conn = OCILogon ("kai", "fjelite", "linux "))
  2. {Echo "SUCCESS! Connected to database/n ";
  3. }
  4. Else
  5. {Echo "Failed:-(cocould not connect to database/n ";}
  6. $ Stmt = OCIParse ($ conn, "select tel, AREA from hkh_tel ");
  7. OCIDefineByName ($ stmt, "TEL", & $ TEL );
  8. OCIDefineByName ($ stmt, "AREA", & $ AREA );
  9. OCIExecute ($ stmt );
  10. While
  11. (// Bbs.it-home.org
  12. OCIFetch ($ stmt ))
  13. {
  14. Echo "TEL:". $ TEL. "/t ";
  15. Echo "AREA:". $ AREA. "/n ";
  16. }
  17. OCIFreeStatement ($ stmt );
  18. OCILogoff ($ conn );
  19. ?>

2. add the execution permission:

  1. Chmod 755/var/www/html/conn_ora.php

3. local debugging:

  1. /Usr/bin/php/var/www/html/conn_ora.php

>>> Articles you may be interested in: php connection to Access database method summary php connection to access database three methods php ADO component connection to access database example php connection to a database simple example about php connection to mssql some summary share a PHP connection to SQL server-like PHP connection to mssql database

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.