Sample code for connecting php to the oracle database
- If ($ conn = OCILogon ("kai", "fjelite", "linux "))
- {Echo "SUCCESS! Connected to database/n ";
- }
- Else
- {Echo "Failed:-(cocould not connect to database/n ";}
- $ Stmt = OCIParse ($ conn, "select tel, AREA from hkh_tel ");
- OCIDefineByName ($ stmt, "TEL", & $ TEL );
- OCIDefineByName ($ stmt, "AREA", & $ AREA );
- OCIExecute ($ stmt );
- While
- (// Bbs.it-home.org
- OCIFetch ($ stmt ))
- {
- Echo "TEL:". $ TEL. "/t ";
- Echo "AREA:". $ AREA. "/n ";
- }
- OCIFreeStatement ($ stmt );
- OCILogoff ($ conn );
- ?>
-
2. add the execution permission:
- Chmod 755/var/www/html/conn_ora.php
-
3. local debugging:
- /Usr/bin/php/var/www/html/conn_ora.php
>>> Articles you may be interested in: php connection to Access database method summary php connection to access database three methods php ADO component connection to access database example php connection to a database simple example about php connection to mssql some summary share a PHP connection to SQL server-like PHP connection to mssql database |