You have two
}'s before the else so it gets triggered every time.
It'd be more efficient to set a
UNIQUE KEY on the email field and then check the amount of
affected rows when inserting to know if it existed or not.
Also as noted in the comments your code is vulnerable to
SQL Injection. I recommend you use