PHP 4.0 Bug #6572 Updated: ODBC_result cannot fetch MEMO fields from MS Access

From: Date: Thu, 21 Sep 2000 02:38:55 +0000
Subject: PHP 4.0 Bug #6572 Updated: ODBC_result cannot fetch MEMO fields from MS Access
Groups: php.dev 
Request: Send a blank email to php-dev+get-33525@lists.php.net to get a copy of this message
ID: 6572 User Update by: mischa@szeker.ch Status: Open Bug Type: ODBC related Description: ODBC_result cannot fetch MEMO fields from MS Access Thanks for your help - it solved the problem. Only one thing doesn't work correctly - the carriage returns. It seems that they are converted to spaces. But I'll try to figure this out myself. Thanks again, mischa@szeker.ch Previous Comments: --------------------------------------------------------------------------- [2000-09-09 23:57:15] torben@php.net Moved in from Bug Report #6645; this appears to be a way of coping. Can the original poster tell whether this helps? - Torben ------------------------------------------------------------ Oddly, this also happens in ASP/vbscript, however you can MEMO fields to work correctly with the following: You can get MEMO fields to work. Right now it takes some finesse. #1) You may try adding SQL_CUR_USE_ODBC #2) You need to use odbc_longreadlen before you use odbc_fetch_row, otherwise it will not read enough characters. #3) As of 4.0.2, making odbc_longread too long may cause PHP to become unstable. #4) You may need to make a query that only returns the MEMO field to read it correctly. Otherwise it sometimes just doesn't work (this is similar in ASP and so is probably a bug with Access or ODBC drivers for it.) Example: $conn = odbc_connect( $DSN, $user, $pw, $SQL_CUR_USE_ODBC ); $result = odbc_exec( $conn, $query ); odbc_longreadlen( $result, 1000000); /* Your odbc_fetch_row, etc, will now work */ --------------------------------------------------------------------------- [2000-09-06 05:23:54] mischa@szeker.ch ODBC_result cannot fetch MEMO fields from MS Access <?php $dsn = "szeker"; $user = "administrator"; $passwort = ""; $verbindung = odbc_connect($dsn, $user, $passwort); $sql = "SELECT * FROM tGuestbook"; $ergebnis = odbc_exec($verbindung, $sql); echo "<table>n"; echo "<tr>"; echo "<td>"; echo odbc_result($ergebnis, "Name"); echo ",<br>n"; echo "<a href="mailto:"; echo odbc_result($ergebnis, "Email"); echo "">"; echo odbc_result($ergebnis, "Email"); echo "</a><br>n"; echo odbc_result($ergebnis, "Date"); echo ",<br>n"; echo odbc_result($ergebnis, "Time"); echo "</td>"; echo "<td>"; echo odbc_result($ergebnis, "Memo"); echo "</td>"; echo "</table>"; odbc_free_result($ergebnis); odbc_close($verbindung); ?> I always get the following error message when I run this script: Warning: SQL error: [Microsoft][ODBC Driver Manager] Invalid cursor state, SQL state 24000 in SQLGetData in c:program filesapache groupapachehtdocsszekernewguestbook.php on line 37 And I'm not the only one - in the language reference there is another user with exactly the same problem. If I change the data type from Memo to Text, everything works fine. But I need more than 255 characters in this field. Is there another possibility to query this field? Or will this bug be fixed? --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=6572

« previous php.dev (#33525) next »