php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15600 ifx_fetch_row return the same tuple more than once
Submitted: 2002-02-18 11:01 UTC Modified: 2002-07-08 22:58 UTC
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: keeper at fly dot srk dot fer dot hr Assigned:
Status: Closed Package: Informix related
PHP Version: 4.1.1 OS: Solaris 7
Private report: No CVE-ID: None
 [2002-02-18 11:01 UTC] keeper at fly dot srk dot fer dot hr
ifx_fetch_row return the same tuple more than once.

This bug is also present in php 4.1.0.

In php 4.0.5 everything works just fine.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-18 11:32 UTC] sander@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

 [2002-02-19 03:25 UTC] keeper at fly dot srk dot fer dot hr
I wanted to list the reseults from the query from the database. I got one tuple as a result.
ifx_num_rows returns 1 at the end of the listing the results.
But, I got 4 same tuples on the output. I used the structure for ifx_fetch_row as described in the example in documantation.
The structure:
$row = ifx_fetch_row ($rid, "FIRST");
 while (is_array($row)) ...

is not working properly...

As I already pointed out, it was all working just fine in php 4.0.5
 [2002-02-19 14:09 UTC] sander@php.net
Can you provide a simple, self-contained (byt complete) sample script?
 [2002-02-20 04:17 UTC] keeper at fly dot srk dot fer dot hr
Of course. Here it is:

        $conn_id=ifx_connect ("prirodo2@nippurtcp", "user", "password");

        if (! $conn_id) {
                echo "<b>Ne mogu se spojiti na bazu</b>";
                exit;
        }

        $rid = ifx_prepare ($select, $conn_id);

        if (! $rid) {
                printf("Do&#353lo je do pogre&#353ke u radu\n");
                zavrsi($conn_id);
        }

        if (! ifx_do ($rid)) {
                printf("Ne mogu izvr&#353iti upit nad bazom podataka\n");
                zavrsi($conn_id);
        }

        $row = ifx_fetch_row ($rid, "FIRST");

        while (is_array($row)) {
                for (reset($row); $fieldname = key($row); next($row)) {
                        $rez = array_values($row);

                        echo $rez[0];
                }
                $row = ifx_fetch_row ($rid, "NEXT");
        }

        $rowcount = ifx_num_rows($rid);

        ifx_free_result ($rid);
        ifx_close ($conn_id);
 [2002-06-20 06:55 UTC] keeper at fly dot srk dot fer dot hr
php 4.2.1 has the same problem.
 [2002-06-20 07:31 UTC] derick@php.net
From the manual:

 position is an optional parameter for a "fetch" operation on "scroll" cursors: "NEXT", "PREVIOUS", "CURRENT", "FIRST", "LAST" or a number. If you specify a number, an "absolute" row fetch is executed. This parameter is optional, and only valid for SCROLL cursors.

You're not using a SCROLL cursor (no parameter to ifx_prepare).

Just use ifx_fetch_row($rid) (without NEXT) and it should work fine.

Please test this, and report back.

Derick
 [2002-06-20 08:28 UTC] keeper at fly dot srk dot fer dot hr
I tried using ifx_fetch_row($rid) (without NEXT or FIRST) but the problem remains.
 [2002-07-08 14:30 UTC] danny dot heijl at cevi dot be
According to Daniel Musante (danimu@hotmail.com) this is the fix:

<quote>

ifx.ec in the last version of php is missing in the
function "ifx_query" the line:

EXEC SQL set connection :ifx;

after the line 777

775         sprintf(descrpid, "descrp%x", IFXG(cursorid));
776
777         PHP_IFX_CHECK_CONNECTION(ifx);
778
779         EXEC SQL PREPARE :statemid FROM :statement;
780

</quote>

I don't know who removed it, or why.

Danny
---
 [2002-07-08 22:58 UTC] sniper@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a documentation 
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.


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