1

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. !?!?!?

1
  • I often get this when I'm using a reserved word. But it seems your not. Have you tried scaling down and see when it breaks? Try adding a single row without some of the columns and see if it works. Then add columns incrementally to see when it breaks. Commented Mar 28, 2011 at 12:03

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

2 Comments

I'm using mysqli::query. Is there an object oriented way of using your function? EDIT: mysqli::multi_query works, thanks
@Codemonkey: sure, mysqli::multi_query

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.