OpOP should ask a new question. Edits to a question after answers have been received are only a good idea to either clarify minor details or for formatting.
In this specific case, asking a new question with the new code that doesn't have the original error anymore sounds perfectly reasonable. You can tell opOP in the comments to do so.