[PHP-DEV] PHP 4.0 Bug #8726: ODBC Connections closing between function calls From: j_schrab <email protected>
Date: 01/15/01

From: j_schrab <email protected>
Operating system: Windows NT - SP 6
PHP version: 4.0.4pl1
PHP Bug Type: ODBC related
Bug description: ODBC Connections closing between function calls

I found that under PHP 4.0.4pl1 / IIS 4 / CGI, odbc_pconnect problems occur under normal odbc_connect.

Example:

function a() {
        $connect = odbc_connect(DB_DSN,DB_USERNAME,DB_PASSWORD);
        $query = "SELECT a FROM e";
        $result = odbc_exec($connect, $query);
        while(odbc_fetch_row($result)){
                print odbc_result($result, 1);
        } // while

        odbc_close($connect);

        return true;
} // a

function b() {
        $connect = odbc_connect(DB_DSN,DB_USERNAME,DB_PASSWORD);
        $query = "SELECT b FROM e";
        $result = odbc_exec($connect, $query);
        while(odbc_fetch_row($result)){
                if (odbc_result($result, 1) == 'z') {
                        a();
                } // if
                print odbc_result($result, 1);
        } // while

        odbc_close($connect);

        return true;
} // b

A call to function "b" will cause a "Warning: 2 is not a valid ODBC result resource" for "odbc_fetch_row" *if* odbc_result($result, 1) == 'z' was true and, as a result, function "a" was called. This seems like a bug. Like the "odbc_close" in function "a" is affecting the condition of the value of "$result" in function "b". Surely PHP allows multple connections to an ODBC data source, right?!

-- 
Edit Bug report at: http://bugs.php.net/?id=8726&edit=1

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>