Correct, if you had a column called `name`. Have you added it?
Gonna see what happens to the query first time it is executed, might did a mistake with the mysql variable.
EDIT:
So yeah, moved the initialize of the variable into the inner section, seems to work now