I want the procedure to take parameter answertable and partid in the select statement, but when i call it it doesn\'t replace the parameter
I believe you cannot do it in this manner.
In order to achieve this, you should use Dynamic SQL.
Note that you cannot open a cursor using Dynamic SQL either. But in your case, there seems to be no need for a cursor.
If i understand your code correctly, you can just use user variables and probably achieve what you are trying to do using 2 Dynamically prepared statements.
SET @stmt_text=CONCAT("SELECT @score = SUM(`score`), @maxscore=SUM(`maxscore`) FROM ",
answertable, "WHERE `idParticipation`= ", partid);
PREPARE stmt FROM @stmt_text;
EXECUTE stmt USING @a;
And then you update the values using the below statement
SET @stmt_text=CONCAT("UPDATE", participationtable, " SET `score`=@score,
`maxscore`=@maxscore WHERE `idParticipation`=", partid);
PREPARE stmt FROM @stmt_text;
EXECUTE stmt USING @a;
DEALLOCATE PREPARE stmt;
Note: Please check the syntax. I cannot test it to verify it exactly but i hope you get the idea.