From:             christophe dot foiret at valdoise dot fr
Operating system: Linux RedHat
PHP version:      4.3.9
PHP Bug Type:     ODBC related
Bug description:  Non returned data

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 bug report at http://bugs.php.net/?id=32618&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=32618&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=32618&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=32618&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=32618&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=32618&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=32618&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=32618&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=32618&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=32618&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=32618&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=32618&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=32618&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=32618&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=32618&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=32618&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=32618&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=32618&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=32618&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=32618&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=32618&r=mysqlcfg

Reply via email to