How to connect an Oracle database from PHP
Forth link in google after searching for your exact questions brought up the following link: http://me2learn.wordpress.com/2008/10/18/connect-php-with-oracle-database/
<?php $db = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.34)(PORT = 1521)))(CONNECT_DATA=(SID=orcl)))" ; if($c = OCILogon("system", "your database password", $db)) { echo "Successfully connected to Oracle.\n"; OCILogoff($c); } else { $err = OCIError(); echo "Connection failed." . $err[text]; }?>
I assumed you want to connect php with oracle databases. so, I give you two of file, this is represent a basic php-oracle for your reference. good luck!
form.php
<form name="form1" method="post" action="login.php"> <label> User Name <input type="text" name="nis" id="nis"> </label> <label> Password <input type="password" name="password" id="password"> </label> <label> <input type="submit" name="submit" id="button" value="Login"> </label></form>
login.php
<?php//create table users (userid varchar2(10), password varchar2(20), constraint pk_users primary key (userid));//insert into users values('kharis', 'pass123');$nis = isset($_POST['nis']) == true ? $_POST['nis'] : '';$password= isset($_POST['password']) == true ? $_POST['password'] : '';if(empty($nis) or empty($password)){ echo "UserID atau Password kosong";}else{ $db = "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = patronus.ad-ins.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE) ) )" ; $connect = oci_connect("HR", "hr", "XE"); $query = "SELECT * from users WHERE userid='".$nis."' and password='".$password."'"; $result = oci_parse($connect, $query); oci_execute($result); $tmpcount = oci_fetch($result); if ($tmpcount==1) { echo "Login Success";} else { echo "Login Failed"; }}?>
PHP provides Oracle OCI8 functions. Other options are PDO with the Oracle Driver and (if oracle supports it) ODBC.