Simply counting

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
EricS
Forum Contributor
Posts: 183
Joined: Thu Jul 11, 2002 12:02 am
Location: Atlanta, Ga

Simply counting

Post by EricS »

I'm working on a PHP script that writes hits to a MySQL database. Is there a single MySQL command that will automatically increment a number in a row?

If not, is it more efficient to look a row up add a number to it and then update that row or is it better to just add each row as a hit and then using a scheduled event, tally the rows up.
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post by Unipus »

update table set row = row + 1;
Post Reply