Suppose you have a column in your table that you use as a counter (storing the value of the counter - eg. times an article has been displayed).
Basically what I used to do is something similar to the following:
- SELECT counter_field_value FROM table1 WHERE column1='this_article'
- Add 1 to counter_field_value
- UPDATE table1 SET counter_field_value=<new_counter_field_value> WHERE column1='this_article'
Combined with a PHP script this could be a few lines for something really small.
The quick trick to this is to do it all in one query:
UPDATE table1 SET counter_field_value=counter_field_value+1 WHERE column1='this_article'
- UPDATE table1 SET counter_field_value=counter_field_value+1 WHERE column1='this_article'