1

I have been trying to make a query in MYSQL, I am doing 2 things in 1 query. My host has a Limit to queries so I need to limit the amount of queries I am doing. When I did the query I get

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 ', (UPDATE users SET last_online=NOW() WHERE username='Welcome_234')' at line 1

I have put a semicolon ";" but it still doesn't work (This query worked in phpMyAdmin).

The code for the query is:

SELECT * FROM `users` WHERE username='Welcome_234',
UPDATE `users` SET last_online=NOW() WHERE username='Welcome_234'

I have tried many hours to figure out the problem and I still haven't found it.

1
  • Thats 2 seperate queries! How are you trying to execute them in your PHP Commented Aug 29, 2021 at 14:53

1 Answer 1

1

Most PHP interfaces to run MySQL queries don't support multiple queries per call. You must run them one query per call.

Your host's limit on queries can't be so low that the difference between one and two queries will break it. I would guess the limit is in place to prevent clients from running excessive loops that run thousands of queries. If it is so low that you can't run two queries, then get a different host.

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

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.