mysql_query('INSERT INTO comments SET tid = "'.$id.'", author = "'.$name.'", mess = "'.$mess.'", time = "'.time().'"');
на
mysql_query('INSERT INTO comments SET tid = "'.$id.'", author = "'.$name.'", mess = "'.$mess.'", time = "'.time().'"');
echo mysql_errno() . ": " . mysql_error() . "\n";