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
/ / ================================================ ========================================================================= Servers: xxxx // Modification: 2002.08.02 // Permission Control: Menu ID --- Function ID ---- / / ==================== ============================================================================================================================================================================================================= ===== // Public files for the database through the ODBC
$ ODBC_NAME = "Database"; $ ODBC_USERNAME = "Informix"; $ dBC_password = "123";
?> ///
File2.txt
/ / ================================================ ========================================================================= Servers: xxxx // Modification: 2002.08.02 // Permission Control: Menu ID --- Function ID ---- / / ==================== ============================================================================================================================================================================================================= ===== // Database Require ("ReportConfig.inc.php") through the ODBC connection database;
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 ();
?>