Hi,
I need to call a stored procedure with output parameters and tried below two methods,
$message = 'ssssss';
$sub_id = 10;
$prize_id = 41;
$command = $connection->createCommand("CALL Proc_testsp(:sub_id,:dynmessage, @dynmessage_replaced, :prize_id)");
$command->bindParam(":sub_id",$sub_id,PDO::PARAM_INT);
$command->bindParam(":dynmessage",$message,PDO::PARAM_STR);
$command->bindParam(":prize_id",$prize_id,PDO::PARAM_INT);
$command->execute();
$valueOut = $connection->createCommand("select @dynmessage_replaced as result;")->queryScalar();
echo $valueOut;
and also
$message = '[Coming_Draw_month]###[%_share]';
$sub_id = 10;
$prize_id = 41;
$command = $connection->createCommand("CALL Proc_testsp(:sub_id,:dynmessage, :dynmessage_replaced, :prize_id)");
$command->bindParam(":sub_id",$sub_id,PDO::PARAM_INT);
$command->bindParam(":dynmessage",$message,PDO::PARAM_STR);
$command->bindParam(':dynmessage_replaced', $dynmessage_replaced, PDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT, '');
$command->bindParam(":prize_id",$prize_id,PDO::PARAM_INT);
$command->execute();
echo $dynmessage_replaced;
Both are not working. Am I missing something ? Please advise