We can perform basic arithmetic on numeric values in our MySQL database directly inside of your SQL syntax. In the following code example we are showing a hit counter example in which each time a dynamic page loads you could run a simple query like this to increment a number for a "View Counter" situation. You are not limited to addition in the query, that is just the example I chose to demonstrate this code.

<?php
// include your MySQL database connection script here
require_once "connect_to_mysql.php";
// Build sql command
$sqlCommand = "UPDATE myTable SET views=(views + 1) WHERE id='$this_page_id'";
// Execute the query here now to add one to the page view count
$query = mysql_query($sqlCommand) or die (mysql_error());
?>