note 10656 rejected from function.odbc-pconnect by didou
| From: | didou@php.net | Date: | Wed, 21 May 2003 16:18:05 +0000 |
| Subject: | note 10656 rejected from function.odbc-pconnect by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-48758@lists.php.net to get a copy of this message | ||
Note Submitter: j_schrab@execpc.com
----
I found that under PHP 4.0.4 / IIS / 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?!