php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46848 Missing Record in query
Submitted: 2008-12-12 12:50 UTC Modified: 2008-12-22 14:37 UTC
Votes:2
Avg. Score:2.0 ± 1.0
Reproduced:0 of 2 (0.0%)
From: lestilucio at gmail dot com Assigned:
Status: Closed Package: InterBase related
PHP Version: 5.2.8 OS: windows xp professional
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lestilucio at gmail dot com
New email:
PHP Version: OS:

 

 [2008-12-12 12:50 UTC] lestilucio at gmail dot com
Description:
------------
Hello,
I'm having a problem with an application developed in PHP, with an interbase/firebird database. I have Firebird 2.0.0 installed.
I use the following code to display the whole records of a table with a query:

Reproduce code:
---------------
$query='SELECT * FROM ARTICLES ORDER BY DESCRIPTION ASC';

$username = "SYSDBA";
$password = "masterkey";
$host = 'C:\myposCE\EMPORIUMDB.GDB';
$conn = ibase_connect($host, $username, $password,'ISO8859_1',0,2)
or die("<br>Connection failed:");
$dati = ibase_query($conn, $query)
or die("<br>invalid query");

while ($row = ibase_fetch_object ($dati)) 
{
echo $row->DESCRIPTION;
echo "<BR>";
}

Expected result:
----------------
I'm expected to see:
1 - GLASS
2 - TABLE
3 - CHAIR

Actual result:
--------------
Actual output:
1- TABLE
2- CHAIR

The problem is that the query miss the first record of the table.
Trying to change the ASC clause in DESC will only miss the last record instead of the first.

If my table contains only a record, the query will display nothing at all!

How can I solve this problem? 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-16 10:02 UTC] mapopa at gmail dot com
I have tested on my ubuntu box (jaunty) with firebird2.1 and php 5.2.6

and the rows are returned correctly 

$query='SELECT * FROM employee ORDER BY LAST_NAME ASC';

$username = "SYSDBA";
$password = "masterkey";
$host = '/var/lib/firebird/2.1/data/employee.fdb';
$conn = ibase_connect($host, $username, $password,'ISO8859_1',0,2)
or die("<br>Connection failed:");
$dati = ibase_query($conn, $query)
or die("<br>invalid query");
$i=0;
while ($row = ibase_fetch_object ($dati))
{
echo ++$i;
echo $row->LAST_NAME;


Here is the result

1Baldwin2Bender3Bennet4Bishop5Brown6Burbank7Cook8De Souza9Ferrari10Fisher11Forest12Glon13Green14Guckenheimer15Hall16Ichida17Johnson18Johnson19Lambert20Lee21Leung22MacDonald23Montgomery24Nelson25Nordstrom26O'Brien27Osborne28Page29Papadopoulos30Parker31Phong32Ramanathan33Reeves34Stansbury35Steadman36Sutherland37Weston38Williams39Yamamoto40Yanowski41Young42Young
 [2008-12-16 10:32 UTC] mapopa at gmail dot com
Tested with latest stable 5.2.8 and results are correct 

/opt/php5.2.8/bin/php -v 
PHP 5.2.8 (cli) (built: Dec 16 2008 12:19:54) (DEBUG)



/opt/php5.2.8/bin/php /var/www/test.php 
1Baldwin2Bender3Bennet4Bishop5Brown6Burbank7Cook8De Souza9Ferrari10Fisher11Forest12Glon13Green14Guckenheimer15Hall16Ichida17Johnson18Johnson19Lambert20Lee21Leung22MacDonald23Montgomery24Nelson25Nordstrom26O'Brien27Osborne28Page29Papadopoulos30Parker31Phong32Ramanathan33Reeves34Stansbury35Steadman36Sutherland37Weston38Williams39Yamamoto40Yanowski41Young42Young


also in flamerobin results are the same 

could you post the php_info ?
 [2008-12-22 11:41 UTC] mapopa at gmail dot com
Tested also on an WindowsXP with php 5.2.8 
and results are correct 
1Baldwin2Bender3Bennet4...
and expected is 
1Baldwin2Bender3Bennet4...
here is the screenshot 
http://picasaweb.google.com/mapopa/CompotuSMOTUBlog#5282577227612712546
 [2008-12-22 14:37 UTC] tony2001@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC