MySQL error: Unknown column 'detector' in 'where clause'