#32618 [Opn->Bgs]: Non returned data
| From: | sniper@php.net | Date: | Thu, 07 Apr 2005 15:48:47 +0000 |
| Subject: | #32618 [Opn->Bgs]: Non returned data | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-76487@lists.php.net to get a copy of this message | ||
ID: 32618
Updated by: sniper@php.net
Reported By: christophe dot foiret at valdoise dot fr
-Status: Open
+Status: Bogus
Bug Type: ODBC related
Operating System: Linux RedHat
PHP Version: 4.3.2
New Comment:
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP --
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php
If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.
Previous Comments:
------------------------------------------------------------------------
[2005-04-07 09:56:46] christophe dot foiret at valdoise dot fr
Description:
------------
Short Description : Non returned data with RAD php application
(dbqwiksite 3.5)
Detail : On a Linux Server with php 4.3.2 and unixODBC driver from
EasySoft.
The pbm is clearly identified. A php page calls functions in the file
qs_functions.php.
All parameters to the DB (Oracle) have been verified and correct
(connection, select, update ...)
When I call the php page on this server no data is returned !!!
When I call the same php page on a Windows 2000 server with php 4.3.3,
date are returned.
When I desactivate the call of the function odbc_fetch_into in the
script,data are returned.
I think that the call of odbc_fetch_array after the call of
odbc_fetch_into triggers this error !
Is it a php bug ?
Thank you in advance, it's urgent
Reproduce code:
---------------
<?php
function qsodbc_num_rows($res)
{
$rowcount = odbc_num_rows($res);
if ($rowcount < 0) {
$rowcount = 0;
while(odbc_fetch_into($res,$fields,1)){
$rowcount++;
}
}
return $rowcount;
}
function qsodbc_fetch_array($res,$row_num)
{
$row = array();
$result = array();
if ($row_num > 0) {
$result = odbc_fetch_row($res,$row_num);
} else {
$result = odbc_fetch_row($res);
}
if ($result) {
$nf = odbc_num_fields($res);
for($i=0; $i < $nf; $i++) {
$field_value = odbc_result($res, $i + 1);
$row[$i] = $field_value;
}
return $row;
}
}
$sql_ext = "";
$conn = odbc_connect("dsn", "user", "pwd");
$sql .= " Select * from table";
if(!$result = @odbc_exec($conn,$sql . " " . $sql_ext)){
$err_string .= "<strong>Erreur</strong> while connecting.<br>" .
odbc_errormsg();
}
if ($result > 0) {odbc_free_result($result);}
$result = odbc_exec($conn,$sql)
or die("Invalid query");
$num_rows = qsodbc_num_rows($result);
echo "Rows=".$num_rows;
while ($row = qsodbc_fetch_array($result,1)) {
print "<br>EXT ".$row[1]." * ".$row[2]." *
".$row[3]."<br>";
}
odbc_close($conn);
?>
Expected result:
----------------
Display of the data
Actual result:
--------------
No data displayed
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32618&edit=1