How does PHP connect Informix database

xiaoxiao2021-03-06  55

In a general C / S structure, if the server is unix, and the database is informix, how do I connect to the database in my door, in PHP, I can install an Informix's main control in the client, then Connect the local ODBC to access the Server's Informis Database. code show as below:

File1.txt

$ ODBC_NAME = "Database"; $ ODBC_USERNAME = "Informix"; $ dBC_password = "123";

?> ///

File2.txt

function db_connect () {global $ ODBC_NAME, $ ODBC_USERNAME, $ ODBC_PASSWORD; $ conn = odbc_connect ( "DATABASE", "informix", "informix"); if die ( "Connection failed") ($ conn!); return $ conn }

Function DB_QUERY ($ conn, $ selectsql) {

$ Result = ODBC_DO ($ conn, $ selectionsql); if (! $ Result) {echo "data execution error: $ selectsql"; exit ();} returnome

Function DB_FETCH_ROW ($ Result) {$ value = odbc_fetch_row ($ result); returnome;}

Function DB_RESULT ($ Result, $ Field_Name) {$ value = odbc_result ($ Result, $ Field_Name);

Return $ Value;}

Function DB_Close ($ conn) {ODBC_Close ($ conn);

$ conn = db_connect ();

?>

转载请注明原文地址:https://www.9cbs.com/read-114310.html

New Post(0)