|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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?
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 02:00:01 2025 UTC |
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