First off all: How do you know wich user has been clicked. You want to deduct points from a user who's link has been clicked. to do this you should pass a variable with the UserId.
<a href="otherpage.php" onClick="clickscript.php?UserId=12">Click Here</a>
If this link is clicked you'll know a link of the user jack wa clicked.
[TABLE]
UserId|Name | Points | Link
12|Jack | 10 | jack.com
13|John | 15 | john.com
First get the clicked user's Id:
$UserId = $_POST['UserId'];
Now the query you should preform is:
$querytop= mysql_query( "select points from outwarinfo where UserId = $UserId" ) or die("Querytop failed");
Now you know how much points the user has.
You can retrieve it by fetching the data.
$ResultTop = mysql_fetch_array($queryTop) or die("ResultTop failed");
$PointsUser = $ResultTop[points];
Know because the link was clicked you want to deduct a point so.
$PointUser = $PointUser - 1;
You can do a check if you're score is negative
if($PointUser<0){
$PointUser = 0;
}
The only thing left to do know is update the database with the new score.
mysql_query( "update outwarinfo set points = $PointsUser where UserId = $UserId" ) or die("Update Query Failed");