Reputation: 79
I get ERROR 1064 (42000) when i try to run:
INSERT INTO ips (ip, created_at, lat, long, country, continent, city, postal_code, state) VALUES ('192.168.2.111', '2019-07-19 12:06:2', '40.3444', '50.44', 'test', 'test', 'test', 'test', 'test');
I created the table with the following command:
CREATE TABLE `ips` ( `id` INT NOT NULL AUTO_INCREMENT, `ip` VARCHAR(255), `created_at` DATETIME, `lat` VARCHAR(255), `long` VARCHAR(255), `country` VARCHAR(255), `continent` VARCHAR(255), `city` VARCHAR(255), `postal_code` VARCHAR(255), `state` VARCHAR(255), PRIMARY KEY( `id` ));
I already tried to run it with ` instead of ' and with putting ' around the columns. Am i missing something obvious here?
Upvotes: 1
Views: 399
Reputation: 147216
long
is a reserved word and must be escaped in backticks. Try this:
INSERT INTO ips (ip, created_at, lat, `long`, country, continent, city, postal_code, state) VALUES ('192.168.2.111', '2019-07-19 12:06:2', '40.3444', '50.44', 'test', 'test', 'test', 'test', 'test');
Upvotes: 3