<html>
<! OracleNewConnection.php                                    >
<! Chapter 13, Oracle Database XE PHP Web Programming         >
<! by Michael McLaughlin                                      >
<!                                                            >
<! The program test a standard and new connection to an       >
<! Oracle database. You should run create_signon_triggers.sql >
<! prior to running this program. The login and logout script >
<! triggers capture connections by building a table, a        >
<! package with two procedures, and two database triggers.    >
<head>
<title>
  Chapter 13: OracleNewConnection.php
</title>
</head>
<body>
<?php
  // Attempt to connect with user schema and password, then TNS alias.
  if ($c1 = oci_connect("php","php","xe"))
  {
    // Print successful message to web page.
    echo "Successfully connected to Oracle.<br />";

    // Delay processing loop.
    if (sleep(5));

    if ($c2 = oci_new_connect("php","php","xe"))
    {
      // Print successful message to web page.
      echo "Successfully connected a new connection to Oracle.<br />";

      // Disconnect from the database.
      oci_close($c2);
    }
    else
    {
      // Assign the OCI error and format double and single quotes.
      $errorMessage = oci_error();
      print $errorMessage['message'];
    }

    // Delay processing loop.
    if (sleep(5));

    // Disconnect from the database.
    oci_close($c1);
  }
  else
  {
    // Assign the OCI error and format double and single quotes.
    $errorMessage = oci_error();
    print $errorMessage['message'];
  }
?>
</body>
</html>
