Jump to content

MS SQL procedure call from PHP


nightleech

Recommended Posts

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.

Link to comment
Share on other sites

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?
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.