nightleech Posted July 20, 2012 Share Posted July 20, 2012 Hello, I need help calling MS SQL procedure from PHP. I'v readed manuals on internet but still doesnt understand how to solve my problem. My chief gave me the MS SQl procedure and wanted that i wrote PHP script that outputs some info. Here is SQL procedure: USE [Database_name] GO DECLARE @return_value int EXEC @return_value = [dbo].[cards] @item = N'Items_code_05115' SELECT 'Return Value' = return_value GO Now, how to execute this procedure and get values from database? I am completly noob at MS SQL procedure execution from php. Please help me to get on the right way. Quote Link to comment Share on other sites More sharing options...
memfiss Posted July 20, 2012 Share Posted July 20, 2012 php make connection to sql server , then u can send queries to server and get answers from it http://www.php.net/manual/en/ref.mssql.php Quote Link to comment Share on other sites More sharing options...
nightleech Posted July 23, 2012 Author Share Posted July 23, 2012 That link doesnt help very much .. So maybe there is a book like working with php and mssql or odbc? And one more question. After executing my php scrip i get an error: SQL error: [Microsoft][ODBC SQL Server Driver] Must declare the scalar variable "@return_value". . So how i could declare that scalar variable? Quote Link to comment Share on other sites More sharing options...
xyph Posted July 23, 2012 Share Posted July 23, 2012 Well, you have to execute each line in your OP in it's own query. Your error is saying you're trying to use @return_value without declaring it. Can we see the code you've made so far? Executing a procedure is just like executing a query, only generally a lot more simple. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.