Hi I have stored procedure written in MySql 5.6 which have 2 input parameter and 2 output parameter ,while i am calling this stored procedure from my php code it throw below error :
Error Code: 1414.
OUT
orINOUT
argument 2 for routine sp name is not a variable orNEW
pseudo-variable inBEFORE
trigger .
I am using below code:
public function get_brand_code_nd_model($phonemake,$phonemodule)
{
$db1=$this->load->database('fonesherpa', TRUE);
$query = $db1->query("Call GetModelnBrandCodeFromName('$phonemake','$phonemodule',@BrandCode,@ModelCode)");
}
I am using below SP
CREATE DEFINER="root"@"localhost" PROCEDURE "GetModelnBrandCodeFromName"(
_BrandName nvarchar(100),
out _BrandCode int ,
_ModelName nvarchar(100),
out _ModelCode int
)
BEGIN
declare temp_IntBrandC int;
declare temp_IntModelC varchar(100);
Set temp_IntBrandC= (Select CompanyCode From MasterMobileBrand where CompanyName =_BrandName);
IF (temp_IntBrandC is NULL) then
Begin
-- select IntBrandC;
Set temp_IntBrandC = (Select CompanyCode From MasterMobileBrand where UserAgentName =_BrandName);
-- print @Intbrandc
End;
end if;
IF (temp_IntBrandC is not NULL) then
Begin
-- select @IntBrandC;
SET _BrandCode = temp_IntBrandC ;
-- select _brandcode;
-- Print @brandcode
SET temp_IntModelC = (select ModelCode from MobileModel where BrandCode = _BrandCode and ModelName like CONCAT('%',_ModelName,'%') limit 1);
-- select @IntModelc;
-- Insert if Model Code does not exist in database
If(temp_IntModelC is NULL) then
Begin
-- select "hello";
set @maxmobcode=(Select (MAX(ModelCode) + 1) From MobileModel);
Insert Into MobileModel(companyname, ModelCode, BrandCode, ModelName, ImageName, IsJavaPhone)
Values(_BrandName,@maxmobcode, _BrandCode, _ModelName, NULL, False);
-- get newly inserted ModelCode
SET temp_IntModelC = (select ModelCode from MobileModel where BrandCode = _BrandCode and ModelName like CONCAT('%',_ModelName,'%') limit 1);
--
-- Print @IntModelc
End;
end if;
If(temp_IntModelC is not NULL) then
Begin
SET _ModelCode = temp_IntModelC;
-- select _brandcode;
-- Print @Modelcode
End;
Else
Begin
SET _ModelCode = -1;
End;
end if;
End;
Else
Begin
SET _BrandCode = -1;
SET _ModelCode = -1;
end;
end if;
End
Please help me how to solve this issue.