Subject | message length error with stored procedures and PHP |
---|---|
Author | neo32478 |
Post date | 2005-04-06T06:19:08Z |
Hi!
I have got a really weird problem lately with Firebird. Whenever I try
to execute a stored procedure that gets parameters as input and
outputs some results, I'll get an error message like this via PHP:
Warning: ibase_query(): message length error (encountered 0, expected
4) in /home/sven/html/db.php on line 506
message length error (encountered 0, expected 4)
Here is the code of test procedure and the code used in PHP to
reproduce that error:
-------------
The procedure
-------------
SET TERM ^ ;
create PROCEDURE test (
inr SMALLINT )
RETURNS (
rnr SMALLINT )
AS
BEGIN
rnr = :inr;
SUSPEND;
END^
SET TERM ;^
------------------
The code at db.php
------------------
function test($nr)
{
$result = ''; //the array where header and description are put
$link = connect(true); //calling another connect function
$sql = "execute procedure basictest('$nr')";
$res = ibase_query($link,$sql) or die(ibase_errmsg());
$row = ibase_fetch_row($res);
return $row[0];
}
----------------------------------
The calling code in some .php file
----------------------------------
<?php echo(test(5));?>
...
Any help would be much appreciated!
Sven Kauber
I have got a really weird problem lately with Firebird. Whenever I try
to execute a stored procedure that gets parameters as input and
outputs some results, I'll get an error message like this via PHP:
Warning: ibase_query(): message length error (encountered 0, expected
4) in /home/sven/html/db.php on line 506
message length error (encountered 0, expected 4)
Here is the code of test procedure and the code used in PHP to
reproduce that error:
-------------
The procedure
-------------
SET TERM ^ ;
create PROCEDURE test (
inr SMALLINT )
RETURNS (
rnr SMALLINT )
AS
BEGIN
rnr = :inr;
SUSPEND;
END^
SET TERM ;^
------------------
The code at db.php
------------------
function test($nr)
{
$result = ''; //the array where header and description are put
$link = connect(true); //calling another connect function
$sql = "execute procedure basictest('$nr')";
$res = ibase_query($link,$sql) or die(ibase_errmsg());
$row = ibase_fetch_row($res);
return $row[0];
}
----------------------------------
The calling code in some .php file
----------------------------------
<?php echo(test(5));?>
...
Any help would be much appreciated!
Sven Kauber