Answer the question
In order to leave comments, you need to log in
Calling a stored procedure php PDO, firebird?
Hello. It is impossible to execute HP by means of PDO. The procedure itself:
CREATE PROCEDURE P_NAME_ID(<br>
INTAB VARCHAR(10),<br>
NAME VARCHAR(60))<br>
RETURNS (<br>
ID INTEGER,<br>
PNO SMALLINT)<br>
AS<br>
DECLARE VARIABLE UPNAME VARCHAR(60);<br>
begin<br>
if (INTAB = 'TGOS') then begin<br>
if ( NOT EXISTS(select ID from TGOS where UPPER(GOS) = :UPNAME) ) then begin<br>
insert into TGOS (GOS) values (:NAME); /* пишем, что пришло */<br>
PNO = 1;<br>
end<br>
select ID from TGOS where UPPER(GOS) = :UPNAME into :ID;<br>
Exit;<br>
end<br>
.....<br>
$sql="CALL P_NAME_ID (?,?,?,?)";<br>
$sth = $dbo->prepare($sql);<br>
$sth->bindParam(1, 'TFAM', PDO::PARAM_STR);<br>
$sth->bindParam(2, 'Post body', PDO::PARAM_STR);<br>
$sth->bindParam(3, $id, PDO::PARAM_INT|PDO::PARAM_INPUT_OUTPUT, 11);<br>
$sth->bindParam(4, $id_, PDO::PARAM_INT|PDO::PARAM_INPUT_OUTPUT, 11);<br>
$sth->execute();<br>
Answer the question
In order to leave comments, you need to log in
Apparently the problem is still with PDO. It will be correct like this:
$sql="EXECUTE PROCEDURE P_NAME_ID ('TFAM','Post body')";
$sth = $dbo->prepare($sql);
$r = $res->fetchAll();
$db = ibase_connect($database, $user, $password)or die($err_logon);
$sql= "EXECUTE PROCEDURE P_NAME_ID ('TFAM','Post body')";
$sql_res = ibase_query($sql, $db);
Everything points to the error here:
$sql="CALL P_NAME_ID (?,?,?,?)";
CALL P_NAME_ID
EXECUTE PROCEDURE
Link
$sql="EXECUTE P_NAME_ID (:INTAB,:NAME,:ID,:PNO)";
$sth = $dbo->prepare($sql);
$sth->bindParam(':INTAB', 'TFAM', PDO::PARAM_STR);
$sth->bindParam(':NAME', 'Post body', PDO::PARAM_STR);
$sth->bindParam(':ID', $id, PDO::PARAM_INT|PDO::PARAM_INPUT_OUTPUT, 11);
$sth->bindParam(':PNO', $id_, PDO::PARAM_INT|PDO::PARAM_INPUT_OUTPUT, 11);
prepare() did not return PDOStatement, most likely it returned false, why it did so, you need to look at the documentation.
$sth->bindParam(1, 'TFAM', PDO::PARAM_STR);
$sth->bindValue(1, 'TFAM', PDO::PARAM_STR);
> Fatal error: Call to a member function bindParam() on a non-object
Error in this. Translate the error. :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question