php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32618 Non returned data
Submitted: 2005-04-07 09:56 UTC Modified: 2005-04-07 17:48 UTC
From: christophe dot foiret at valdoise dot fr Assigned:
Status: Not a bug Package: ODBC related
PHP Version: 4.3.2 OS: Linux RedHat
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: christophe dot foiret at valdoise dot fr
New email:
PHP Version: OS:

 

 [2005-04-07 09:56 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-07 17:48 UTC] sniper@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 23:01:30 2024 UTC