By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,053 Members | 1,125 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,053 IT Pros & Developers. It's quick & easy.

Reccord locking with PHP & MySQL

P: n/a
Hello to all,

Could somebody tell me if it's possible to lock a record
with PHP when I have a simple MySQL Database by a provider
?

Many thanks in advance for your help.

Best regards

Otto

Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
hi,Otto

Could somebody tell me if it's possible to lock a record
with PHP when I have a simple MySQL Database by a provider


I'm not clear what you really want.
If you want to LOCK the record in you SQL-SERVER level, for Mysql, that's
impossible.
If you want only to lock a record in your PHP program, so that not to make
any mistake in mutile-thread/request. That's possible.
The simplest way is to create a file in tmp folder, with name like:
DB-TABLE-ROWNUM.lock,
each response from php, check if there was a .lock file.
Just like .pid file in *nix.

best regards
Wang
Jul 17 '05 #2

P: n/a
Hello Wang

Many thanks four your quick answer.
I'm not clear what you really want.
If you want to LOCK the record in you SQL-SERVER level, for Mysql, that's
impossible.
If you want only to lock a record in your PHP program, so that not to make
any mistake in mutile-thread/request. That's possible.
The simplest way is to create a file in tmp folder, with name like:
DB-TABLE-ROWNUM.lock,
each response from php, check if there was a .lock file.
Just like .pid file in *nix.
Sorry my english is not perfect. Yes I like to lock a record in my PHP
program. The table is not on my PC, but by the provider.

The simplest way is to create a file in tmp folder, with name like:
DB-TABLE-ROWNUM.lock,

Is this possible, when the MySQL server isn't installed locally ?
Because I didn't see any tmp folder by the provider.

Regards

Otto


Jul 17 '05 #3

P: n/a
Hi,Otto.
Is this possible, when the MySQL server isn't installed locally ?
Because I didn't see any tmp folder by the provider.

It will work wether the MySQL server installed locally or remotely.
The file:DB-TABLE-ROWNUM.lock file should be created in your PHP-Server, not
your MySQL Server.
The main idea of this way is to create a global mark in your PHP-server, so
that each thread could know what's goning on on certain block. Just like
when i want you know I've been here today, I post an article with subject"
Wang Has Been Here" in this group. :)

Wang
Jul 17 '05 #4

P: n/a
Does MySQL support row-level locking in ISAMDB but may be with InnoDB?

"Otto Haldi" <oh****@freesurf.ch> wrote in message
news:VA******************@freesurf.ch...
Hello to all,

Could somebody tell me if it's possible to lock a record
with PHP when I have a simple MySQL Database by a provider
?

Many thanks in advance for your help.

Best regards

Otto

Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.