Re: Re: MySQL executes several times the same request
| From: | Randy C Boland | Date: | Wed, 30 Jun 2004 20:42:24 +0000 |
| Subject: | Re: Re: MySQL executes several times the same request | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-35061@lists.php.net to get a copy of this message | ||
I'm not sure where the value of $counter is coming from, but it you're
getting it from a SQL SELECT query, it would be more efficient to just
use:
UPDATE statistics SET VALUE(
counter = counter+1)
It's just one less query on the DB, which could make a difference if
you're getting heavy traffic.
> > > $counter++;
> > > $SQL = "UPDATE statistics SET VALUE (counter =
> > > $counter)"
> > > $res = mysql_query($SQL);
> > > mysql_closedb($DB);