Correctly interpret PHP odbc skills. When we apply odbc code in PHP: classodbc_db {var $ connull; var $ resourcenull; function _ construct () {} functionconnect ($ dsn, $ user, $ passwd, $ cu when we are applying
PHP odbc application code:
- Class odbc_db
- {
- Var $ con = null;
- Var $ resource = null;
- Function _ construct ()
- {
- }
- Function connect ($ dsn = ",
$ User = ", $ passwd = ",
$ Cursor_type = 0)
- {
- ! $ Dsn & $ this->Debug ('dsn not provided! ');
- $ This->Con = odbc_connect ($ dsn, $ user
, $ Passwd, $ cursor_type );
- ! $ This->Con & $ this->Debug ('conncet failed! ');
- Return $ this->Con;
- }
- Function query ($ SQL = ")
- {
- $ This->Resource = odbc_exec ($ this->Con, $ SQL );
- ! $ This->Resource & $ this->Debug
('Query failed! ');
- Return $ this->Resource;
- }
- Function fetch_array ($ resource = ")
- {
- ! $ Resource & $ resource = $ this->Resource;
- Return odbc_fetch_array ($ resource );
- }
- Function query_first ($ SQL = ")
- {
- $ Resource = $ this->Query ($ SQL );
- Return odbc_fetch_array ($ resource );
- }
- Function fetch_all ($ resource = ")
- {
- ! $ Resource & $ resource = $ this->Resource;
- $ Results = array ();
- While (false! ==( $ Row = @ odbc_fetch _
Array ($ resource )))
- {
- $ Results [] = $ row;
- }
- Return $ results;
- }
- Function num_rows ()
- {
- Return odbc_num_rows ($ this->Con );
- }
- Function affected_rows ()
- {
- Return odbc_num_rows ($ this->Con );
- }
- Function debug ($ message = ")
- {
- $ Message. ='
- The following error messages are provided by ODBC: '. odbc_errormsg ();
- Exit ($ message );
- }
- Function _ destruct ()
- {
- Odbc_close ($ this->Con );
- }
- }
- ?>
The above are all the steps for PHP to apply odbc, and I hope to help you.
Specific odbc application code in PHP: classodbc_db {var $ con = null; var $ resource = null; function _ construct () {} functionconnect ($ dsn =, $ user =, $ passwd =, $ cu...