can oci_connect be in a function?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bdbeames
    New Member
    • Jun 2007
    • 27

    #1

    can oci_connect be in a function?

    I have a oracle/php question

    I'm moving a site from postgres/mysql to oracle.

    In the past I've written a funtion for my database connection and stored it in initialize.php then I included the file on pages where I need to use the function. The function follows:

    Code:
    function initialize() {
       $user= ***;
       $pass=***;
       $host=***;
    $db = pg_connection($user $pass $host);
    //$db = oci_connect($user, $pass, $host);
    }
    The thing is I am trying to use oracel and if $db = pg_connect is replace with $db = oci_connect inside of the function I get errors. If it is written in the same file, but not in a function it works.

    My question is why doesn't oracle allow me to call the oci_connect within a function or am I just doing something wrong.
Working...