|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #330 Cannot retrieve BLOB fields
Submitted: 1998-04-29 09:35 UTC Modified: 1998-04-29 09:56 UTC
From: tma at gatehouse dot dk Assigned:
Status: Closed Package: ODBC related
PHP Version: 3.0 Release Candidate 4 OS: WinNT 4.0 SP3
Private report: No CVE-ID: None
 [1998-04-29 09:35 UTC] tma at gatehouse dot dk
This script displays the fields STATUS (smallint) and DESCRIPTION (longvarchar) from the SYMPTOM table.
The data source is of type MS SQL Server.

$connect_id = odbc_connect("gh", "tma", "password") or die("Unable to connect to SQL server");
$query = "use errorh";
$result  =  odbc_exec($connect_id, $query)  or  die( "SQL USE query failed");
if  (!$result)  {
    echo  "Unable to select database.\n";
    return  0;
$query = "select status,description from symptom";
$result  =  odbc_exec($connect_id, $query)  or  die( "SQL query failed");
if  (!$result)  {
    echo  "Unable to perform query.\n";
    return  0;
$field_count  =  odbc_num_fields($result);
echo  "<table  border=1  width=\"95%\"><tr>\n";
while  (odbc_fetch_row($result))  
    for  ($i = 0;  $i < $field_count;  $i++)
        $row[$i] = odbc_result($result, $i+1);
    echo  "<tr>\n";
    for  ($i = 0;  $i < $field_count;  $i++)  {
	echo  "<td>";
        echo  "$row[$i]\n";
	echo  "</td>";
echo  "</table>\n";

When run using a PHP3-dev version dated 11-02-98, the BLOB
fields are passed through to the client and appear outside the table.

When using RC4, *nothing* is displayed. This also happens
if I use odbc_binmode() settings of 0, 1 or 2.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [1998-04-29 09:56 UTC] kara
odbc_binmode() affects columns that contain binary data. Longvarchar columns contain only ascii
data, use odbc_longreadlen() to control output behaviour.
If you have a LONG column with binary data (longvarbinary), you have to use both odbc_binmode()
and odbc_longreadlen().
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Apr 08 06:01:25 2020 UTC