MySQL loop problem

Hello,
I must create a MySQL function with twenty which inserts data into a table.
Here is my code:

DELIMITER |
CREATE FUNCTION dataInsert(id INT)
BEGIN
SET @count = 0;
WHILE @count < id 
BEGIN
   INSERT INTO user (id, acti, views) VALUES ((id+1),  'OK', 0);
   SET @count = (@count+1)
END
END
|

Can you tell me the error in this code?
Thank you.

Why, does it give you an error?