1

I got this request:

"START TRANSACTION; DELETE FROM `awaiting_auth` WHERE `code` = '06b8465eed00727a1eac49fae89b88f876ded2eb' LIMIT 1; INSERT IGNORE INTO `prsn` SET `login` = 'new_user', `passwd` = '40bd001563085fc35165329ea1ff5c5ecbdbbeef', `color` = '#cbc5f2'; COMMIT;"

And I receive 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 'DELETE FROM awaiting_auth WHERE code = '06b8465eed00727a1eac49fae89b88f876de' at line 1".

However when executing sql via terminal everything goes well and no errors are thrown.
What is wrong with my request? Thanks in advance.

2
  • Use mysqli_error($conn) and see what you get Commented Aug 12, 2013 at 11:07
  • 2
    how you execute this using php? post relevant code Commented Aug 12, 2013 at 11:07

4 Answers 4

2

You must split the queries in separate ->query() calls. The SQL console does that automatically. E.g.

->query("START TRANSACTION");
->query("DELETE FROM...");
Sign up to request clarification or add additional context in comments.

Comments

0

One operation per query. So you need to split your query into single queries.

Comments

0

Just run these queries one by one, not in single packet.

Comments

0

Try to execute each statement individually:

START TRANSACTION;
DELETE FROM `awaiting_auth` WHERE `code` = '06b8465eed00727a1eac49fae89b88f876ded2eb' LIMIT 1;
INSERT IGNORE INTO `prsn`(`login`, `passwd`, `color`) VALUES('new_user','40bd001563085fc35165329ea1ff5c5ecbdbbeef', '#cbc5f2');
COMMIT;

Comments

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.