There is no PHP syntax error here, as you can easily demonstrate by pasting your code into a page by itself:
<?
$query = "INSERT INTO $userstable VALUES('$realname', '$username',
'$password', '$email', 'n', '$ff3exp')";
echo $query;
?>
Often a line number of a syntax error is incorrect because the real cause of the error is embedded in a previous line -- an open quote, for example.
Also, Karsten's answer is incorrect. You do not need to disassemble the string into multiple strings and use the concatenation operator. PHP will perform variable substitution on double-quoted strings.