PHP and MSSQL stored procedure

So I am new to php and programming in general

I am able to connect to our MSSQL DB with the following connection string
[php]

<?php $serverName = "dls-dbdev-02"; $connectionInfo = array( "Database"=>"KD_RACE_DATA", "UID"=>"username", "PWD"=>"password"); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn ) { echo "Connection established.
"; }else{ echo "Connection could not be established.
"; die( print_r( sqlsrv_errors(), true)); } ?>

[/php]

I then want to run a stored procedure and pass a parameter and then display the result but im just lost…
The stored proc is called uspAddTwoNumbers (I had our dba create this simple one so I can test and try to figure it out)
SQL StoredProcedure

USE [KD_RACE_DATA]
GO
/****** Object:  StoredProcedure [dbo].[uspAddTwoNumbers]    Script Date: 3/7/2013 12:21:30 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[uspAddTwoNumbers]
	@FirstNum	int = 0,
	@SecondNum	int = 0
as
	begin
		select @FirstNum + @SecondNum	Total
	end

So I want to pass two numbers lets sat 1 and 2 and then echo out the answer which should be 3 but I really am lost. I tried looking online for help but just can’t seem to figure it out?

Sponsor our Newsletter | Privacy Policy | Terms of Service