This is a discussion on Executing SQL Server Stored Procedures With PHP - Executing stored procedures within the PHP Programming forums, part of the Web Development category; hi, Here we can see to execute SP from PHP page Executing a stored procedure with PHP and the mssql_xxx ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| hi, Here we can see to execute SP from PHP page Executing a stored procedure with PHP and the mssql_xxx set of functions is easy. To execute a stored procdure that accepts no parameters and doesn't return a value, we only need to make use of the mssql_init and mssql_execute functions. To create SP GO CREATE PROC sp_test AS -- Add a record to the shippers table INSERT INTO test(CompanyName, Phone) VALUES('Buddies Infotech', '044-43009605'); To execute from PHP page <?php $myServer = "localhost"; $myUser = "sa"; $myPass = ""; $myDB = "test"; $s = @mssql_connect($myServer, $myUser, $myPass) or die("Couldn't connect to SQL Server on $myServer"); $d = @mssql_select_db($myDB, $s) or die("Couldn't open database $myDB"); $query = mssql_init("sp_test", $s);//call SP $result = mssql_execute($query);//Execute the SP as a query ?>
__________________ With, J. Jeyaseelan Everything Possible |
| Sponsored Links |
| |||
| We can also run our stored procedure using query analyzer with the following code: use test EXEC sp_test If we have any param it should give along with like EXEC sp_test 2 Here 2 is the param sent to the SP
__________________ With, J. Jeyaseelan Everything Possible |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Performance Tuning Tips About Sql Server Stored Procedures | vadivelanshanmugam | Database Support | 0 | 02-04-2008 06:16 AM |
| Performance Tuning Tips About Sql Server Stored Procedures | vadivelanshanmugam | Database Support | 0 | 02-04-2008 06:14 AM |
| Some Performance tuning tips about SQL Server Stored Procedures | vadivelanshanmugam | Database Support | 0 | 02-04-2008 06:12 AM |
| SQL Server Undocumented Stored Procedures | a.deeban | Database Support | 2 | 12-23-2007 11:20 PM |
| SQL Server Undocumented Stored Procedures | a.deeban | Database Support | 3 | 09-04-2007 03:31 AM |