The problem is attempt to use ' inside a single-quoted string. The most robust solution is to replace each interior ' with '''