Adding in database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Adding in database

Post by tecktalkcm0391 »

is there anyway to add 1 to the current number in the database, where if another user does it at the same time they both will process?
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

Im pretty sure that when 2 (or more) commands are run at the same time. It locks the database adds 1 to the number, unlocks it then the 2nd command runs and adds 1 to the database, so you don't have anything to worry about.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

even with a MySQL Database.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

tecktalkcm0391 wrote:even with a MySQL Database.
Yes, with most databases writes are what is called atomic -- meaning that each pending write is processed only after the previous one is completed.
(#10850)
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

Is a MyISMA MySQL Table/Database like this?
Post Reply