Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
rating system update - overlaps
Old 08-02-2010, 11:17 PM rating system update - overlaps
orionoreo's Avatar
Ultra Talker

Posts: 335
Name: Jerry
Trades: 0
I might be a newb for asking this or i'm just overthinking

i have a rating system wheere when someboy rates it grabs the number from the db, do the math and then update the number in the row

if two people happen to click rate at the same time.. wouldn't that cause problems or chances of that happen is like winning the lottary
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
orionoreo is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-02-2010, 11:32 PM Re: rating system update - overlaps
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
If you're pulling a value from the database and then updating it in a separate query there is a chance that the value will be modified by a separate process between the select and update queries.

A way to avoid this would be to have the database "do the math" instead of PHP. Depending on how you are storing and calculating you may be able to do it with an update query, or you may have to use a stored procedure.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is offline
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Reply     « Reply to rating system update - overlaps
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.19673 seconds with 12 queries