Unknown column 'class' in 'where clause'