mysql error creating table
your foreign key definitions are wrong, you switched table and column names.

this should work:

CREATE TABLE IF NOT EXISTS apuntats(
    id INT NOT NULL AUTO_INCREMENT,
    idcurs INT NOT NULL,
    idusuari INT NOT NULL,
    coneixements TEXT,
    motiu TEXT,
    FOREIGN KEY(idcurs)
        REFERENCES cursos(id)
        ON DELETE CASCADE,
    FOREIGN KEY(idusuari)
        REFERENCES usuaris(id)
        ON DELETE CASCADE,
    PRIMARY KEY(id)
);