"end;" is not valid PHP. The closing curly-brace } tells PHP that the statement block ends. You don't need to say "end".
By the way, when asking for help, it is usually best to give a description of what happens (error message, nothing displayed, server catches fire, whatever) rather than just saying that it doesn't work.