You can let MySQL perform the update for you, no need to fetch the counter and update it in MySQL..
UPDATE table SET counter = counter + 1 WHERE id = ?
This is also atomic, so multiple hits at the same time wont cause counts to be missed. If you need to insert the record if it does not exist first, you could change this query to the following, provided you have a unique/primary key on the 'id' column:
INSERT INTO table (id, counter) VALUES (?, 1) ON DUPLICATE KEY UPDATE counter = counter + 1
This will both deal with inserting the record if it does not exist already, and if it does, update it. This is more efficient then executing multiple queries to check if the record exists first and insert if missing.
See here for more information:
http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html