note 29908 added to function.odbc-result

From: Date: Fri, 28 Feb 2003 08:29:47 +0000
Subject: note 29908 added to function.odbc-result
Groups: php.notes 
Request: Send a blank email to php-notes+get-44652@lists.php.net to get a copy of this message
About memo fields accessing through ODBC. I got error: SQL error: [Microsoft][ODBC Visual FoxPro Driver]Invalid cursor position, SQL state S1109 in SQLGetData SQL error... In fact there is no necessity to change Memo to Text type of field in database. Example of source code: class ds_fconstr extends db_base_table { var $db_fields = array('name' => "", 'password' => ""); $query = "SELECT * FROM ds_fconstr"; $odbc = odbc_connect (DB_DSN, "", "") $req = odbc_exec ($odbc, $query) // create this class $temp = new ds_fconstr(); // error inside of this function (of parent class) // when try call "odbc_result" for "memo" field $temp->setFieldsValue ($req); // all OK here foreach ($temp->db_fields as $name => $value) { $temp->db_fields[$name] = odbc_result($req,$name); } } // where base class is following Class db_base_table { var $db_fields = array(); // set value of fields from fetched row // ---------------------------- function setFieldsValue($req) { foreach ($this->db_fields as $name => $value) { // error is HERE (only for "memo" fields, others are ok), // because (possible) PHP do not transfer // correctly result of odbc_exec with "memo" $this->db_fields[$name] = odbc_result($req,$name); } } }; So, when i call directly "odbc_result" in the same function where i have called "odbc_exec" then all is right (see line "// all OK here"). -- http://www.php.net/manual/en/function.odbc-result.php http://master.php.net/manage/user-notes.php?action=edit+29908 http://master.php.net/manage/user-notes.php?action=delete+29908 http://master.php.net/manage/user-notes.php?action=reject+29908

« previous php.notes (#44652) next »