let's suppose that u want to count the clicks on link1
in the href of link1 you don't put the real link to link1 but you put a link to a script that is :
<?
bla bla // operation with sql - you modify the counter for the link1
header("Location: link1"); // this is a redirect to the real link1
?>
i hope u understoond my poor english