Hello I been struggling with this problem the Store procedure executes but returns no message when i run it on the PHP but when I run it on the SQL management studio it returns the message I hope someone can help me see the code attached
SP
If(@Type='2') -- Update
Begin
If (@idpn='')
Begin
Select 'Please select a P/N!' As [Message], '0' As [IsPass]
Return;
End
If (@iecpn='')
Begin
Select 'Please enter an IECPn!' As [Message], '0' As [IsPass]
Return;
End
If (@hppn='')
Begin
Select 'Please enter an HPPn!' As [Message], '0' As [IsPass]
Return;
End
If (@location='')
Begin
Select 'Please enter a location ['+@location+']!.' As [Message], '0' As [IsPass]
Return;
End
If (@MaxQty='')
Begin
Select 'Please enter a MaxQty ['+@MaxQty+']!.' As [Message], '0' As [IsPass]
Return;
End
If (@MinQty='')
Begin
Select 'Please enter a MinQty ['+@MinQty+']!.' As [Message], '0' As [IsPass]
Return;
End
If (@PNDescription='')
Begin
Select 'Please enter a Description ['+@PNDescription+']!.' As [Message], '0' As [IsPass]
Return;
End
If Not Exists (Select * From WHS_MaterialMaster (NoLock) Where Id=@idpn and Status='1')
Begin
Select 'This P/N:['+@hppn+']-['+@iecpn+'] does not exists. Please verify it!' As [Message], '0' As [IsPass]
Return;
End
Set @descr='Max='+isnull(@MaxQty,'')+'~Min='+isnull(@MinQty,'')+'~Rack='+isnull(Left(@location,1),'')+'~Drawer='+isnull(Substring(@location,2,2),'')+'~Level='+isnull(Right(@location,1),'')+'~'
Update WHS_MaterialMaster set IECPartNo=@iecpn,CPQPartNo=@hppn,PartDesc=@PNDescription,Qty=@StrQty,Description=@descr,Editor=@Editor,Udt=@datetime
Where Id=@idpn and Status='1'
Insert Into IMXPRD.dbo.GlobalHistory (ItemId,Program,[Function],[Description],[User],WorkStation,[Type],Editor,Cdt,Udt)
values (@idpn,'WHSInventory','WHSOperation',isnull(@iecpn,'')+'~'+isnull(@hppn,'')+'~'+isnull(@PNDescription,'')+'~'+isnull(@StrQty,'')+'~'+isnull(@descr,'')+'~'+@location,@Editor,@Hostname,'UPDT',@Editor,@datetime,@datetime)
Select 'This P/N:['+@hppn+']-['+@iecpn+'] has been updated. Please verify it!.' As [Message], '1' As [IsPass]
Return;
PHP code
$sql ="exec sp_IMX_WHSInventoryKanban_md '215','WC0537006001','635199-001','A01A','99','110','10','Este N/P es para prueba del sistema de WHS!!!','','ISA100115','IMX-100115-01','2'";
$stmt = sqlsrv_query($this->conn, $sql );
$json = array();
if( $stmt === false) {
die( print_r( sqlsrv_errors(), true) );
}
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
$json['tMaterialMaster'][]=$row;
}
echo json_encode($json);
SELECT
results. It can be done bysqlsrv_next_result($stmt)
and you should put this two times () be careful for the first one, if you return error like Please ..., you shouldn't move to the nextsqlsrv_next_result
. – alalp May 17 at 6:20