473,385 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Reccord locking with PHP & MySQL

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
4 6186
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: jkelty | last post by:
Hello, I just have a question about the table locking in 3.23.56. If I am inserting a row into a table that is MyISAM type, is the entire table locked? And, if so, what does this mean for...
0
by: Steve McWilliams | last post by:
Hello, I am relatively new to MySql (4.0.14) but I have read through the relevent documentation and am still confused about how row level locking behaves with InnoDB tables. I created a...
0
by: Wayne Smallman | last post by:
OK, anyone have some advice on implementing the likes of SELECT ... FOR UPDATE / SELECT ... LOCK IN SHARE MODE? I'm trying to get it working in conjunction with the transaction facilities built...
4
by: MLH | last post by:
A programmer developed an AMP (Apache/MySQL/PHP) application for me. When he was done, he sent me the PHP files and the MySQL dump file. Now, when I connect to the application on my LAN using...
0
by: Christopher DeMarco | last post by:
Hi all... ...I've got a Python script running on a bunch of boxen sharing some common NFS-exported space. I need (not want :) to lock files for writing, and I need (not want :) to do it safely...
1
by: dennis van Alphen via AccessMonster.com | last post by:
I was trying to make a macro that wil setvalue in a table, it works, the only problem i have is that it overwrites an older existing reccord, how do I manage the macro to pick a new reccord, I hav...
1
by: jimi_usenet | last post by:
Hi, Can anyone tell me if MySQL uses optimistic or pessimistic locking with InnoDB tables? And can this be modified in any way? When I use the search function on the mysql site, it only gives me...
0
by: shakahshakah | last post by:
Just started investigating InnoDB after having used MyISAM tables in the 4.0.12 version, almost immediately ran into a locking issue with INSERTs, DELETEs, and transactions. Given the following...
5
by: jmichel | last post by:
ok I want to do a dump daily of my database, this works fine, however the problem I have is that while the dump is executing itself, I cant access my website cause the thing locks tables I think. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.