Subject Re: Solved! message length error with stored procedures and PHP
Author neo32478
I got it now :) I should have inserted this


$sql = "select * from test('$nr')"; instead of this:
$sql = "execute procedure test('$nr')";



--- In firebird-support@yahoogroups.com, "neo32478" <neo32478@y...> wrote:
>
>
> 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 test('$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