Php connection to oracle and simple operations enable your php to support oracle. follow these steps: 1. to install the php environment, find appserv or xampp and install it with one click. 2. copy php_oci8.dll under the ext directory of php to the system32 directory. modify php. remove & nb php from the configuration in the INI file to connect to oracle and perform simple operations.
To enable your php to support oracle, follow these steps:
1. install the php environment. find appserv or xampp and install it with one click, which is very convenient.
2. copy php_oci8.dll under the ext directory of php to the system32 directory.
3. modify the configuration in the php. ini file and remove it. extention = php_oci8.dll and remove the semicolon
4. restart apache
Connect to the oracle database in two ways
1. $ conn = oci_connect ('username', 'password', "(DEscriptION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.100) (PORT = 1521 )) (CONNECT_DATA = (SID = test )))");
2. $ conn = oci_connect ('username', 'password', '192. 168.1.100/test ');
Sometimes the first method does not work. The second method uses the following parameters: user name, password, and oracle service address. test is the service name.
$ SQL = "select * from table_exmaple"
$ Ora_test = oci_parse ($ conn, $ SQL); // compile an SQL statement
Oci_execute ($ ora_test, OCI_DEFAULT); // execute
While ($ r = oci_fetch_row ($ ora_test) // Retrieve the result
{
Echo $ ora_test [0];
Echo"
";
}