Skip to content
Advertisement

“Unknown column in ‘field list'”, but column does exist

DROP TABLE IF EXISTS `transactions`;
CREATE TABLE `transactions` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `purchase_date` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `transactions` (`purchase_date`) VALUES (NULL)

I’ve isolated my problem in this code. When I run it, I get the error:

[ERROR in query 3] Unknown column ‘purchase_date’ in ‘field list’

Anyone an idea?

Advertisement

Answer

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.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement