I'm trying to do something like this:
mysql_query("
UPDATE name SET money = money + 1;
UPDATE surname SET money = money + 1;
");
but it doesn't work.
It's just example, but my question is: How can I put two or even more queries in one mysql_query
?
http://docs.php.net/mysql_query says:
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 .
But you might be interested in mysqli::multi_query:
Executes one or multiple queries which are concatenated by a semicolon.
You should use transactions for queries that need to happen in an atomic fashion, which I suspect these may.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With