Subject | Re: [firebird-php] Iterating through results. |
---|---|
Author | Dan Wilson |
Post date | 2004-10-07T13:16:24Z |
Hallo Uwe,
On 10/7/2004 at 1:34 PM Uwe Oeder wrote:
> I am using Apache 2.0.52 , PHP 5.0.2 , Firebird 1.5.1
> I am using the php_interbase.dll extension.
>
> Question 1 :
> Is there any newer version or a .dll specific for firebird ?
I'm using the php_interbase functions, and know of nothing newer or firebird specific.
>
> I prepard the following query:
> $DBHandle = ibase_connect ($host,$username,$password) or
> die ("error in db connect") ;
>
> $SQLStmt = "SELECT CountryName FROM Country ORDER BY CountryName" ;
> $SQLQuery = ibase_prepare($SQLStmt) ;
> $SQLData = ibase_execute($SQLQuery) ;
>
> $TotalCountry = ibase_affected_rows() ;
> echo "TotalCountrys = " . $TotalCountry ;
> for ($Countrys = 1 ; $Countrys <= $TotalCountrys ; $Country++)
> {
> $row = ibase_fetch_row($SQLData) ;
> echo $row[0] ;
> }
>
> Question 2 :
> There should be more than 50 records displaying but interbase/firebird
> reports 0 were affected.
> How do I iterate through the resultset of a query ?
>
Try it this way instead:
$DBHandle = ibase_connect ($host,$username,$password) or
die ("error in db connect") ;
$SQLStmt = "SELECT CountryName FROM Country ORDER BY CountryName" ;
$SQLQuery = ibase_prepare($SQLStmt) ;
$SQLData = ibase_execute($SQLQuery) ;
if ( !$SQLData )
{
echo "Unexpected query error for $query<br>";
}
else
{
$TotalCountry = 0;
while ( ($row = ibase_fetch_row( $SQLData ) ) != false )
{
$TotalCountry++;
echo $row[0];
}
echo "TotalCountrys = " . $TotalCountry ;
ibase_free_result( $SQLData );
}
> Question 3 :
> Where can I find all the functions available to me ?
>
>
The PHP documentation has a complete listing of ibase/firebird functions in the function list for Firebird/Interbase. See http://www.php.net/manual/de/ref.ibase.php for a list auf Deutsch.
HTH,
Dan.