Subject Re: [firebird-support] Serious PHP question
Author Almond
At 14:04 03/06/23 +1000, you wrote:
>I'm using PHP, and FirebirdSQL, and I've hit a big snag...
>
>I'm trying to use a stored procedure that requires quotes around the input
>parameters(it's a varchar, with spaces all through it)
>
>There are no examples of how to get it to go.
>
>Here's a test case:
>create table tbl_test (
> str_test VARCHAR(100)
>);
>
>set term !! ;
>create procedure sp_find (
> str_test varchar(100)
>) returns (
> int_count INTEGER
>) AS BEGIN
> select count(*) from tbl_test where str_test = :str_test INTO :int_count;
> suspend;
>END !!
>set term ; !!
>
>The procedure is simplified for example purposes.
>
>Now the PHP side:
>$prep = ibase_prepare("SELECT * FROM SP_FIND(?)");
>while($name = (gets set from another query - but can contain spaces)){
> $extravar = $name->STR_TEST; // Put it into another variable
> $rec = ibase_execute($prep,$extravar);
>--------if $extravar has spaces, it dies--------
>
> $rec = ibase_execute($prep,'$extravar');
>--------it dies all the time, "Value '?' unknown" -----------

Using single quote the variable is not translated to content. So. what you
pass is the string "$extravar" and not the content.

$a = 'abcdefg';
echo '$a '. "$a";

OUTPUT : $a abcdefg

There should be no problem using varchar in procedure call on php.


>How are parameters for Stored. Procs quoted when necessary?
>
>You are the last resort...
>
>
>--------------------------------------------------------
>Nigel Weeks
>E-Easy
>15 Wellington St. Launceston Tas 7250
>Ph. 61 3 6334 6664
>Fax. 61 3 6331 7032
>Email. nigel@...
>Web: www.e-easy.com.au
>--------------------------------------------------------
>
>
>
>To unsubscribe from this group, send an email to:
>firebird-support-unsubscribe@yahoogroups.com
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/