Unknown column '$key' in 'where clause'