Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

cannot connect to oracle database

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

cannot connect to oracle database

Postby nicolealcock » Mon Apr 28, 2014 11:43 pm

I am a newby on php..I need to connect to validate username and password to an oracle database... I've used the following code:
<?php

function my_error_handler($errno, $errstr, $errfile, $errline) {
if (preg_match('/ORA-28002: [ a-zA-Z]*([0-9])+/', $errstr, $matches)) {
echo "Your password will expire within ${matches[1]} days\n";
}
}


set_error_handler("my_error_handler", E_WARNING);

$c = @oci_connect("flt_admin", "fad01", "fmrdb01-dev.gmtwc.gov.za:1521/fltd");
echo "hell0 world";
if (!$c) {
$m = oci_error();
echo "Connection failed: " . $m['message'] . "\n";
} else {
echo "Connected OK\n";
// Prove the connection is valid
$s = oci_parse($c, "select 'Query is OK' as c from dual");
oci_execute($s);
$r = oci_fetch_array($s, OCI_ASSOC);
echo $r['C'] . "\n";
}

restore_error_handler();

?>
When I run it I get no error messages just a blank screen. Can someone please tell me where I am going wrong. I have amended php.ini file to connect to
extension=php_oci8.os
extension=php_oci8_11g.os
nicolealcock
New php-forum User
New php-forum User
 
Posts: 1
Joined: Mon Apr 28, 2014 11:32 pm

Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 10 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron