As WorldMaker notes, you need a WHERE clause.
I don't think that MySQL supports the ++ operator, and SQL92 probably doesn't have it either, so re-write to:
$query = "
UPDATE tablex
SET counter = counter + 1
WHERE userID=$userID
";
(Make sure that you check the $userID value before you introduce it into an SQL expression. If $userID is an integer, then you could start by forcing it to be an integer, using the intval() function.)