Connecting to an Oracle Database using PHP

For connection to the Faculty’s Oracle Databases two ODBC connections have been set up on the IIS server stuiis.cms.gre.ac.uk, one for the Obiwan server and one for Quigon. The following two lines of code can be used to connect to either server:


$conn=odbc_connect("server","username","oraclepassword"); $strSQL = "SELECT last_name, city, phone_no FROM supplier ORDER BY city"; $result = odbc_exec($conn, $strSQL); while(odbc_fetch_row($result)){ $last_name = odbc_result($result, 1); $city = odbc_result($result, 2); $phone_no = odbc_result($result, 3); print("$last_name $city $phone_no\n"); } odbc_close($conn)


Comments are closed.