How can I put two queries in one mysql_query?

前端 未结 4 1505
我寻月下人不归
我寻月下人不归 2020-12-21 04:47

I\'m trying to do something like this:

mysql_query(\"
  UPDATE name SET money = money + 1;
  UPDATE surname SET money = money + 1;
\"); 

bu

4条回答
  •  北海茫月
    2020-12-21 05:21

    This can be done using the MySQLi interface, mysqli_multi_query() in particular. http://ca3.php.net/manual/en/mysqli.multi-query.php

    It should be noted that you need to be extra careful with your escaping when using this function as any SQL injection attack has a much broader possible affect.

提交回复
热议问题