Possible bug in PHP 5 (Interbase related)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Bitmaster
Forum Newbie
Posts: 20
Joined: Thu Nov 21, 2002 8:42 am

Possible bug in PHP 5 (Interbase related)

Post by Bitmaster »

I'm trying to build an application that uses the Firebird (Interbase) database server, but I've recently run into the following problem:
I cannot seem to be able to return a result handle from a PHP function. I always get the following error when I attempt to run ibase_fetch_assoc () on the value returned from ibase_execute ().

Code: Select all

Warning:  ibase_fetch_assoc(): 4 is not a valid Firebird/InterBase result resource 
in D:\WWW\test_ibase.php on line 22
Here is the sample code:

Code: Select all

<?php
	echo ("<pre>");

	function do_query ($dbc, $sql)
	{
		$stmt = ibase_prepare ($dbc, $sql);
		$res = ibase_execute ($stmt);

		return $res;
	}

	$db = "localhost:d:/www/ibtest.gdb";
	$user = "SYSDBA";
	$password = "masterkey";

	$dbc = ibase_connect ($db, $user, $password);

	$sql = "SELECT * FROM test";

	$res = do_query ($dbc, $sql);

	while ($row = ibase_fetch_assoc ($res))
	{
		print_r ($row);
	}
?>
If I move the while-loop from lines 22 - 25 to line 8 above, everything works just fine...

WTF ?

Does anyone have any ideas ? Am I doing something wrong ?

Thanks in advance for any feedback !

EDIT: I tested this on PHP 5.0.2 and 5.0.4

phpinfo () - Interbase section says:

Firebird/InterBase Support dynamic
Compile-time Client Library Version Interbase 6
Run-time Client Library Version WI-V6.3.1.4481 Firebird 1.5
Post Reply