Hackerss.com is a community of amazing hackers

Hackerss is a community for developers, data scientitst, ethical hackers, hardware enthusiasts or any person that want to learn / share their knowledge of any aspect of digital technology.

Create account Log in

Posted on

Php Connect to oracle database

function connectToOracle($username, $password, $database) {
  //connect to oracle database
  $conn = oci_connect($username, $password, $database);
  //check if connection is successful
  if (!$conn) {
    $e = oci_error();
    trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
  //return the connection
  return $conn;

$conn = connectToOracle('username', 'password', 'database');

$conn; //connection object

Enter fullscreen mode Exit fullscreen mode

Top comments (0)