RE: [PHP-WIN] re: making a DB counter
| From: | Matt Babineau | Date: | Thu, 25 Apr 2002 18:54:06 +0000 |
| Subject: | RE: [PHP-WIN] re: making a DB counter | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-13310@lists.php.net to get a copy of this message | ||
Thanks Scott I think this will help, will let you know how it comes out.
Matt Babineau
Freelance Internet Developer
e: mbabineau@illuminatistudios.com
p: 603.943.4237
w: http://www.illuminatistudios.com
-----Original Message-----
From: Scott Hurring [mailto:scott@eacnet.com]
Sent: Thursday, April 25, 2002 2:52 PM
To: Php-Win (E-mail)
Subject: RE: [PHP-WIN] re: making a DB counter
Try this:
http://www.mysql.com/doc/L/O/LOCK_TABLES.html
That seems to be what you're asking for...
to lock down the table while you select,
then update...
---
Scott Hurring
Systems Programmer
EAC Corporation
ScottH@eac.com
Voice: 201-462-2149
Fax: 201-288-1515
> -----Original Message-----
> From: Matt Babineau [mailto:matt@criticalcode.com]
> Sent: Thursday, April 25, 2002 2:41 PM
> To: 'Php-Win (E-mail)'
> Subject: [PHP-WIN] re: making a DB counter
>
>
> 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
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php