From: "rory oconnor" <[EMAIL PROTECTED]>

> I'm setting up some tracking stats for (opt-in) e-mail campaigns, and
> one of the things I'm tracking is click-thrus.  I'm going to re-direct
> traffic thru a script that will just count the number of clicks, and
> store that number in a mysql table.
>
> It needs to be fast and efficient, and I'm somewhat of a mysql newbie,
> so I was wonderinf if there is any more efficient way to simply add a
> number to the existing number in that table with mysql and perl.  My way
> seems like a lot of code to do a little task.  Any help is appreciated!


Instead of getting the current # out of the db, incrementing it, and then
updating the field, try this:

CREATE TABLE foo (clicks INT);
INSERT INTO foo SET clicks=0;
SELECT * FROM foo;
UPDATE foo SET clicks=clicks+1;
SELECT * FROM foo;
UPDATE foo SET clicks=clicks+1;
SELECT * FROM foo;
UPDATE foo SET clicks=clicks+1;
SELECT * FROM foo;
DROP TABLE foo;

You can increment 'columnname' with 'columnname+1'; that way, you don't need
to get the current value first.


--
denonymous
www.coldcircuit.net



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to