Solved

Why is PHP function odbc_result() yielding an empty string for MS-Access memo fields?

Posted on 2008-06-20
2
1,120 Views
Last Modified: 2013-12-13
I'm writing PHP code to dynamically show values from a query to an MS-Access database. I'm using the odbc_ group of PHP functions to do this. In the attached snippet, the $name argument references a field-name in the Access database. Now, the actual Access field that's referenced may be a text field (max. 255 characters) or a memo field (max. 65KB). For some reason, when a memo field is referenced, its value shows up as an empty string when I use function odbc_result(). By contrast, Access text fields are fetched with no problem, using the same line of code in my snippet below. How do I get the memo field values returned from function odbc_result()?
// Part of PHP code that builds an HTML string to echo to the web browser.
// The field $name may reference a an Access text or memo field.
$row .= odbc_result($docResultId, $name);

Open in new window

0
Comment
Question by:bob2ee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
Rurne earned 125 total points
ID: 21834316
By default, odbc_result doesn't know how to convert MEMO to BLOB or CLOB.  You'll need to use odbc_longreadlen() to set how "big" the column is in order to read the memo field appropriately.
http://us2.php.net/manual/en/function.odbc-longreadlen.php
0
 

Author Closing Comment

by:bob2ee
ID: 31469265
I apologize, but it turned out that the odbc_result() behaviour was being affected by odbc_fetch_row(). I.e., the latter function was the cause of my problem. SO I suggest you delete the entire question from the Experts Exchange system. Again, my apologies to EE and expert Rurne.
0

Featured Post

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question