You pass a GET parameter in the url to dictate what item is increased, and then issue an insert or update statement.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
You add a querystring to the link for whatever name the $image_id has been extracted from. Make sure you filter it through mysql_real_escape_string too.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
So you cannot change the HTML, but want to change what the HTML does?
Why can you not change the HTML?
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
function countclick($advert_id)
{
include ('config.php');
mysql_query("UPDATE adverts SET clicks = clicks + 1 WHERE advert_id = '" . $advert_id . "'") or die(mysql_error());
You don't. The first code is PHP which is server side, and the second one is a client side link. The href in that link has to target a PHP script that is capable of calling countclick.
Perhaps that javascript countclick has some ajax or something that calls the PHP script?
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php