optimal way of counting votes in online poll

From: Date: Wed, 28 Feb 2001 10:37:35 +0000
Subject: optimal way of counting votes in online poll
Groups: php.general 
Request: Send a blank email to php-general+get-41990@lists.php.net to get a copy of this message
Hi all! I have a question as to the optimal method of counting and storing votes in an online poll. Once a user answers the poll by clicking on one of three options, I am performing a query on a table which holds values for each option. Currently I - query the table to get the current count - increment the count by 1 - UPDATE the table with the new value I wonder: what happens if two users submit the answer simulatneously, and the answer is the same. Will only of those votes register? Or will the SQL somehow be "queued" so that both are counted? If the former - is there any other, better way to do this? I am using mySQL as the database, and PHP to process the form and execute the query. Please CC your response to the address above also. TIA Vikram Vaswani

« previous php.general (#41990) next »