You can avoid the step of extracting the row data by doing:
"UPDATE mytable SET numclicks = numclicks + 1"
-Kevin
-Original Message-
From: rory oconnor [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 20, 2002 8:44 AM
To: [EMAIL PROTECTED]
Subject: fast,efficient query for counting
I'm
$dbh =
DBI->connect("DBI:mysql:database=$database;host=$host","$user","$mysqlpassword",{'RaiseError'=>1});
$update_number = "UPDATE $table set total_clicked = total_clicked + 1";
$sth = $dbh->prepare("$update_number");
if (!$sth) { die "Error:" . $dbh->errstr . "\n"; }
if (!$sth->execute) {
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.
>
Hi,
You can just do an UPDATE:
UPDATE $table set total_clicked = total_clicked+1
Regards
rory oconnor wrote :
>
> 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 jus