Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

T-SQL proc submitted from php does not run

Status
Not open for further replies.

SimonSellick

Programmer
Nov 3, 2003
305
GB
Hi,

I'm submitting a complex series of updates as a T-SQL block from a PHP script. The return does not show an error but it also does not return a row as expected and has not updated the database. If I submit a simpler block it works as expected. If I catch the complex block text and paste it into QA it runs correctly and returns the expected row.

One difference is that I have a begin transaction / commit / rollback in the failing block. If I remove it, the database gets updated but the call still returns nothing (and I need the rollback facility).

Is there a preferred way to submit an executable T-SQL block, or am I correct in using the mssql_query function?

Any pointers would be appreciated.
 
Maybe you should put it into a stored procedure? Or if this is a series of stored procs, put them all into one?

If you are trying to submit this all as an ad-hoc request from your application, it is really a php question.

HOpe this helps,

Alex

[small]----signature below----[/small]
I can't compete with you physically, and you're no match for my brains.
You're that smart?
Let me put it this way. Have you ever heard of Plato, Aristotle, Socrates?
Yes.
Morons!
 
Hi Alex,

Thanks for the reply. A stored proc would probably be more elegant, but it would need about 30 parameters - and a variable number of them - so I decided to just build the T-SQL block on the fly.

I will re-post in the PHP forum as you suggested.

Regards,

Simon.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top