Stored Procedure with parameters out

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
FelipeRau12
User
Posts: 45

Stored Procedure with parameters out

Post by FelipeRau12 »

Hello

I have a problem with a stored procedure that has 4 parameters out I am not able to retrieve the return. I am using the following script:

$sOrdemind = "CALL ord03_spregistrarordemindustrializacaoexmlentrada( ";
$sOrdemind = $sOrdemind." '".$chave."', ";
$sOrdemind = $sOrdemind." '".$nminfcplsistema."', ";
$sOrdemind = $sOrdemind." '', ";
$sOrdemind = $sOrdemind." '".$nNF."', ";
$sOrdemind = $sOrdemind." '".$serie."', ";
$sOrdemind = $sOrdemind." '".$dEmi."', ";
$sOrdemind = $sOrdemind." '".$emit_xNome."', ";
$sOrdemind = $sOrdemind." '".$emit_xFant."', ";
$sOrdemind = $sOrdemind." '".$CNPJCPF."', ";
$sOrdemind = $sOrdemind." '".$emit_IE."', ";
$sOrdemind = $sOrdemind." '".$emit_fone."', ";
$sOrdemind = $sOrdemind." '".$emit_xLgr."', ";
$sOrdemind = $sOrdemind." '".$emit_nro."', ";
$sOrdemind = $sOrdemind." '', "; // Complemento
$sOrdemind = $sOrdemind." '".$emit_xBairro."', ";
$sOrdemind = $sOrdemind." '".$emit_cMun."', ";
$sOrdemind = $sOrdemind." '".$emit_CRT."', ";
$sOrdemind = $sOrdemind." '".$emit_CEP."', ";
$sOrdemind = $sOrdemind." ".CurrentUserID().", ";
$sOrdemind = $sOrdemind." ".ew_cdusuario().", ";
$sOrdemind = $sOrdemind." @r_cdordemindustrializacao, ";
$sOrdemind = $sOrdemind." @r_cdcliente, ";
$sOrdemind = $sOrdemind." @r_erro, ";
$sOrdemind = $sOrdemind." @r_cdmensagem);";
Conn()->Execute($sOrdemind);


			   
               $sbuscar = "select @r_cdordemindustrializacao,@r_cdcliente,@r_erro,@r_cdmensagem ";				   
               $rsbuscar = Conn()->Execute($sbuscar);
			   //$rsbuscar->MoveFirst();
			   echo $rsbuscar->fields('@r_cdordemindustrializacao');
                                echo "<br>";
			   echo $rsbuscar->fields('@r_cdcliente');
			   echo "<br>";
			   echo $rsbuscar->fields('@r_erro');
			   echo "<br>";
			   echo $rsbuscar->fields('@r_cdmensagem');
			   die();

The following error is occurring

atal error: Uncaught Error: Call to a member function fields() on boolean in C:\wamp64\www\NovoFac\ordemindustrializacaoarquivoinfo.php on line 927

Thanks


Webmaster
User
Posts: 9425

Post by Webmaster »

Not sure if what you need is properly supported by ADOdb or not, but you may try to prepare the SQL first, e.g.

$sql = Conn()->Prepare($sOrdemind);
Conn()->Execute($sql);
...


FelipeRau12
User
Posts: 45

Post by FelipeRau12 »

Hello,

I solved the problem, in the stored procedure had a select command line that displayed on the screen the parameters out. Thus when executing the stored procedure it returned only 1 parameter. In this case you would not need to do the bottom line in the select @parametros

I changed the stored procedure and removed the line that had the select from the parameter out and worked correctly.

Sorry for the inconvenience, the stored procedure had been done by a trainee

Thanks


Post Reply