MySQL throws error even though query syntax is correct
This has got be stumped. I've almost literally copied this query directly into heidiSQL's query field and run it successfully.
I'm getting this error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ';
INSERT INTO dots(`name`, `sambandsnr`, `dslam`, `ip`, `lat`, `lng`, `on' at line 1
On this query
DELETE FROM dots;
INSERT INTO dots(`name`, `sambandsnr`, `dslam`, `ip`, `lat`, `lng`, `online`)
VALUES
("...", "...", "...", "...", "...", "...", "..."),
("...", "...", "...", "...", "...", "...", "..."),
("...", "...", "...", "...", "...", "...", "..."),
("...", "...", "...", "...", "...", "...", "..."),
("...", "...", "...", "...", "...", "...", "..."),
("...", "...", "...", "...", "...", "...", "..."),
("...", "...", "...", "...", "...", "...", "..."),
("...", "...", "...", "...", "...", "...", "..."),
("...", "...", "...", "...", "...", "...", "..."),
("...", "...", "...", "...", "...", "...", "..."),
("...", "...", "...", "...", "...", "...", "..."),
("...", "...", "...", "...", "...", "...", "..开发者_运维技巧.");
The real script has real data and around 800 rows. Seriously, I have copy&pasted the first 10 rows and run the query manually successfully. That completely stumps me as to how there can be an error at line 1.
Any help would be appreciated
Edit: I just copied the ENTIRE failing script into the query editor and ran it. It ran successfully. !?!?!?
You seem to send two queries at once.
Either send them separately, or use a multi-query function to do that (mysqli_multi_query
in PHP
).
To do this you have to use MySQLi
extension: MySQL
extension is not able to send multiple queries in one statement.
From the documentation:
mysql_query()
sends a unique query (multiple queries are not supported) to the currently active database on the server that's associated with the specified link_identifier.
精彩评论