mysql stuff when click on link then go to link
<p>I have a phpBB forum, some posts contains Links... I want to count how many times the link on the post has been visited...</p>

<p>I think that catching the "click" on the link, make php and mysql stuff and, then after all, go to the external link is the best way ... but I dont know how to do that.</p>

<p>Its possible to interrupt the link click, modify some things and then load de link as always? (maybe using ajax or jquery)</p>

<p>A link example could be:</p>

<p>www.google.com</p>

<p>The mysql table called phpbb_likes contains:</p>

<pre><code>Like_id
Post_id
User_id
Like_time
</code></pre>

<p>I know how to add a new like using something like this:</p>

<pre><code>Insert INTO phpbb_likes ("Post_id","User_id","Like_time") VALUES ("2355","45","1343546456");
</code></pre>

<p>But the problem is interrupting the link redirecting to make that sql query</p>

<p>Any Idea?
thanks</p>