Calling MSSQL stored procedure from Zend Controller ? Any other approaches?
Posted
by
Bhavin Rana
on Programmers
See other posts from Programmers
or by Bhavin Rana
Published on 2012-09-15T05:30:35Z
Indexed on
2012/09/15
9:50 UTC
Read the original article
Hit count: 349
MSSQL and DB, Zend as PHP Framework,
I am using this way to call SP with I/P Parameters and to get O/p Parameters.
It seems I am writing SQL code in PHP.
Any other good approaches?
$str1 = "DECLARE @Msgvar varchar(100); DECLARE @last_id int;
exec DispatchProduct_m_Ins $DispatchChallanId,'$FRUNo',$QTY,$Rate,$Amount,
".$this->cmpId.",".$this->aspId.",".$this->usrId.",@Msg = @Msgvar OUTPUT,@LAST_ID = @last_id OUTPUT;
SELECT @Msgvar AS N'@Msg',@last_id AS '@LAST_ID'; ";//Calling SP
$stmt = $db->prepare($str1);
$stmt->execute();
$rsDispProd = $stmt->fetchAll();
$DispatchProductId = $rsDispProd[0]["@LAST_ID"];//get last ins ID as O/p Parameter
© Programmers or respective owner