Hallo!
I'd like to get some information. I've got 2 problem:
-If several user edit the same row simultaneously, only the last result will remain in the db. How can I avoid that? I tried to write the sessionid of the first editor in the row, and block the other users to edit the same row. Any other/better idea?
-I've got some DML (insert,update,delete) step in several php, and I'd like to handle them as a transaction. If I good know, it cannot done with standard mysql commands, because every db access stop at the end of a php. How can I do that?
Thx.
SzCs
Transactions in multiple PHP pages using MYSQL
Moderator: General Moderators
Re: Transactions in multiple PHP pages using MYSQL
Hi,SzCs wrote:Hallo!
I'd like to get some information. I've got 2 problem:
-If several user edit the same row simultaneously, only the last result will remain in the db. How can I avoid that? I tried to write the sessionid of the first editor in the row, and block the other users to edit the same row. Any other/better idea?
-I've got some DML (insert,update,delete) step in several php, and I'd like to handle them as a transaction. If I good know, it cannot done with standard mysql commands, because every db access stop at the end of a php. How can I do that?
Thx.
SzCs
Well, first off, you don't want several users to have simultaneous access to a row! This kind of thing can result in data corruption. What is your application doing that you would desire this?
As for transactions, are you talking about transactions from a database point of view? If that be the case, and you're using MySQL, you will also need to use the Inno base tables and start all transactions with a BEGIN command to the db. If everything works as planned, write the information to disk with a COMMIT command. Otherwise, you can back out of all of your changes with a ROLLBACK command.
Now I'm not really sure what it is you're doing and/or talking about so I apologize if none of this helps.
Cheers,
BDKR
Thats it. I don't want several users to have simultaneous access to a row! I'd like to know, how can I avoid it.
And the transactions are transactions from a database point of view. But I can't use BEGIN, COMMIT and ROLLBACK, because the duration of a transaction can't be longer than a single php. My application uses around 10 php for a single "transaction". (get the name of a project, choose the place of the project from a hierarchical /javascript/ tree, choose the manager from an other tree....) So I can't use BEGIN, COMMIT and ROLLBACK, so I need some other solution.
Thx.
SzCs
And the transactions are transactions from a database point of view. But I can't use BEGIN, COMMIT and ROLLBACK, because the duration of a transaction can't be longer than a single php. My application uses around 10 php for a single "transaction". (get the name of a project, choose the place of the project from a hierarchical /javascript/ tree, choose the manager from an other tree....) So I can't use BEGIN, COMMIT and ROLLBACK, so I need some other solution.
Thx.
SzCs
What exactly are you trying to do? I understand you don't want people accessing the same row at the same time, so maybe you could set up permissions to the database. And I have no clue what you're talking about the the single lines of php code. Maybe if you explain exactly what you're trying to accomplish with the database we could be of more help.
Jade
Jade