鍍金池/ 問答/PHP  數(shù)據(jù)庫/ 數(shù)據(jù)庫mysqli_use_result

數(shù)據(jù)庫mysqli_use_result

有兩個(gè)數(shù)據(jù)庫連接$conn1和$conn2,當(dāng)我使用$conn1->query('sql1',mysqli_use_result),之后在使用$conn2來從數(shù)據(jù)庫取出數(shù)據(jù)。$conn2 會(huì)產(chǎn)生Commands out of sync錯(cuò)誤嗎?
嘗試了一下,感覺當(dāng)我使用一個(gè)mysqli_use_result之后,所有的表都被鎖了,知道那個(gè)sql執(zhí)行完成之后,其他query才執(zhí)行

回答
編輯回答
硬扛

在mysql官網(wǎng)上看到的
On the other hand, you should not use mysql_use_result() for locking reads if you are doing a lot of processing for each row on the client side, or if the output is sent to a screen on which the user may type a ^S (stop scroll). This ties up the server and prevent other threads from updating any tables from which the data is being fetched.

2018年8月27日 06:53