"Unknown column in 'field list'", but column does exist

There is an unprintable character 30 (RecordSeparator) inserted between purchase_date and the ' in the INSERT statement. Just remove the text ('purchase_date') and rewrite it by hand it should be fine.


I just spent the better part of a day figuring this out. My problem was the same: invisible characters kiboshing the query and returning the "unknown column" error.

I solved it by wading back into Windows and removing the garbage using NotePad++.

How did the garbage get in there in the first place? I think it was because I made the mistake of copying some long complex queries into LibreOffice Writer (my functional specs document) instead of just bookmarking them in phpMyAdmin or saving them in a text editor. Pasting them from LibreOffice into the query window is where (I think) the garbage originated.

Once there, it persisted like Malaria. I couldn't even get rid of it by hand-retyping the whole query -- I had to put it into NotePad++ (Encoding menu) and show ANSI and the UTF8 combos and then remove the garbage by hand.

Once that was done, the query worked.


Nery niche solution when I got this error.

I had a BEFORE INSERT trigger on my table that did something with NEW.`field_mysql_doesnt_think_exists` and if I didn't pass that field to an insert statement then I would get

[ERROR in query 3] Unknown column 'field_mysql_doesnt_think_exists' in 'field list'