JS
<script>
function myAjax() {
$.ajax({
type: "POST",
url: 'ajax.php',
data:{action:'call_this'}
});
</script>
HTML
<a href="'. $row['link'] .'"target="_blank" onclick="myAjax()">
PHP
<?php
require ("static/php/inc/betaconfig.inc.php");
if($_POST['action'] == 'call_this') {
$conn->query("UPDATE users SET clicks = (clicks + 1) WHERE id = 13");
}
?>
Normally it should be $uid instead of 13 but I don't know how to do that too...
First of all, why this doesnt work ? 2nd $uid is $id = $_REQUEST['id'];
and then
$sql = "SELECT * FROM `link` WHERE id = '$id'";
$result4 = $conn->query($sql);
while($row = $result4->fetch_assoc()) {
$uid = $row['userid'];
}
so the best thing that instead of 13 I could use $uid