Jump to content

Transactions From Php Scripts


chibineku
 Share

Recommended Posts

I have several PHP scripts in my site, for example logging, logging out, adding items to your basket, etc. I was wondering what the arguments are in favour of, and against, using stored transactions. On the face of it, it seems like they might make things simpler, but is there any difference from just handwriting the code into a PHP script? Are there security concerns? Are there any real differences at all apart from the rollback feature?

Link to comment
Share on other sites

Yes, that's the one. It all comes under the same chapter heading in the book I have.

Link to comment
Share on other sites

Stored procedures are generally faster because they are compiled and optimized on the database. This is only database code though, you can't mess with the PHP session or read data from $_POST or whatever, it's basically just a function you define on the database to do several things instead of sending one or more queries. But since the database server compiles them they are faster than sending individual queries.

Link to comment
Share on other sites

Ah. Well, every query I make is dependent on variables from the session or POST, so not really any good to me.

Link to comment
Share on other sites

Ah, ok. Given your knowledge, from my many many threads, of my scripts, would you suggest implementing them? I believe for the moment I will leave well enough alone, but once the site is launched I can play around with things to improve efficiency.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...