Put quotes around key & id in sql query. 

This was causing errors in mysql environment.