Error is: Unknown column 'pid' in 'where clause'