This question already has an answer here:
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, and why they didn't work.
"why they didn't work".
That's a stupid phrase. You don't know why it didn't work. How about "and what error you got" or "and what you expected to happen".
If folks knew why it didn't work, 90% of them wouldn't come here.