PHP connection with Oracle 10g?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
adilmarwat2004
Forum Commoner
Posts: 44
Joined: Fri Sep 04, 2009 11:28 pm

PHP connection with Oracle 10g?

Post by adilmarwat2004 »

Dear!

I have installed Oracle 10g and PHP.
I want to made the connection of PHP with oracle 10g. How it is possible and is it possible through Dreamweaver. if it please provide the way for connecting?
thanks

Adil
User avatar
papa
Forum Regular
Posts: 958
Joined: Wed Aug 27, 2008 3:36 am
Location: Sweden/Sthlm

Re: PHP connection with Oracle 10g?

Post by papa »

Sure it is.

I did an application for Oracle 10 a couple of months back. Search google for tutorials.

I put my DNS in a config.ini and made a simple db class.

Not very pretty though:

Code: Select all

 
    function __construct($username, $password, $db_name='', $host='', $tns='')
    {
        //Db Vars
        $this->username       = $username;
        $this->password   = $password;
        $this->db_name        = $db_name;
        $this->host           = $host;
        $this->tns            = $tns;
        
        //Connect to db
        if(!($this->conn = self::db_connect())) die("<b>Error:</b> No Connection to Database");
    }
    
    function db_connect()
    {
        if($oci = @oci_connect($this->username, $this->password, $this->tns)) return $oci;
        else return false;
    }
Post Reply