assumptions:
users is the name of the table with the user's information
userspoints is the name of the field holding the number of points the user has
events is the name of the table with the event's information
neededpionts is the name of the field with the points an even costs
<?php
$sql = "select (a.userspoints - b.neededpoints) as difference from users as a, events as b WHERE userid = $userID";
$query = mysql_query($sql);
$pointsLeft = mysql_result($query,0,0);
if($pointsLeft < 0) {
//user does not have enough points
} else {
$sql = update users set userspoints = $pointsLeft;
mysql_query($sql);
//user has enough points
}
?>