re: making a DB counter

From: Date: Thu, 25 Apr 2002 18:40:57 +0000
Subject: re: making a DB counter
Groups: php.windows 
Request: Send a blank email to php-windows+get-13307@lists.php.net to get a copy of this message
Here is a snip of my code $query = "SELECT Count FROM COUNTER_Page_Views WHERE Counter_ID = '" . $count_id . "' FOR UPDATE"; $query1 = "UPDATE COUNTER_Page_Views SET Count = Count + 1 WHERE Counter_ID = '" . $count_id . "'"; $result = mysql_query($query); $result1 = mysql_query($query1); what is happeneing is that seesion are colliding in between these queries, I need to somehow single thread this section of code. Is that possible? MySQL says that you can lock rows for updating but it only seems to work when the queries are in the same code block, not when executed separately. Anyone have a solution to making an update to a record without having other users make an update in the middle of a different users' process? Matt Babineau Freelance Internet Developer e: <mailto:mbabineau@illuminatistudios.com> mbabineau@illuminatistudios.com p: 603.943.4237 w: <http://www.illuminatistudios.com/> http://www.illuminatistudios.com

« previous php.windows (#13307) next »