开发者

MySQL and PHP synchronicity sanity check

开发者 https://www.devze.com 2023-01-20 07:16 出处:网络
I\'m troubles开发者_StackOverflow中文版hooting a bug and trying to rule out all possible explanations for why I\'m witnessing the behavior that I am.I\'m executing a number of MySQL queries in PHP (vi

I'm troubles开发者_StackOverflow中文版hooting a bug and trying to rule out all possible explanations for why I'm witnessing the behavior that I am. I'm executing a number of MySQL queries in PHP (via CodeIgniter's Active Record class) and one explanation for the behavior that I'm seeing is that the queries aren't being executed synchronously, i.e. that PHP isn't waiting for the query to complete before issuing the next one.

I've always coded under the assumptions that if I insert something into a MySQL table via PHP, and then my next line of code executes a select, the results of my insertion will be available in the next statement. Are there any exceptions to this being the case?

Thanks for helping me preserve my sanity...


If you select it on the same server, and are using the same session/connection, and you haven't used INSERT DELAYED it should exist indeed, but loadbalanced MySQL servers / implementations / caching may divert SELECT's to other servers or data locations....

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号