As far as I could tell, there is no parse error in the lines of code that you have posted. I copied it as is and tested it on my box for you just to be sure.
Do you have any HTML or anything prior to these lines of code at all?
How are you creating your document/file?
Also, you may want to change your sql query statement to rid it of redundancy.
MYSQL_QUERY ("INSERT INTO $table VALUES('firstname','lastname','email')");
MYSQL_QUERY ("INSERT INTO $table VALUES('$firstname','$lastname','$email')");
could be:
// create query statement
$query = "INSERT INTO $table ('firstname','lastname','email')";
$query .= " VALUES('$firstname','$lastname','$email')";
// Perform Query
$result = mysql_query($query);
if ($result) {
echo 'query executed.';
}
else
{
echo 'Invalid query: ' . mysql_error() . "\n";
exit;
}