[PHP-DEV] Bug #330: Cannot retrieve BLOB fields From: tma <email protected>
Date: 04/29/98

From: tma <email protected>
Operating system: WinNT 4.0 SP3
PHP version: 3.0 Release Candidate 4
PHP Bug Type: ODBC related
Bug description:
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.