I guess the single quotes are doing something different than you expected. Better compose a $statement string which you then prepare and execute, otherwise you are entering text (ASCII chains) cause the single quoted var names won't be evaluated, or did I get something wrong now?
Have a nice day All decision is left to your taste