PDO Cannot execute queries while other unbuffered queries are active

前端 未结 4 1431
一个人的身影
一个人的身影 2020-12-03 13:48

I know this has to be a simple fix and I partially understand why I am getting this error but don\'t know how to fix it. I\'ve looked over the docs but can\'t find a solutio

4条回答
  •  孤街浪徒
    2020-12-03 13:59

    I ran into this problem due to an error in my PDO connection clause. I was trying to change the timezone upon connecting:

    PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8; SET time_zone = '$timezone';"
    

    I changed it to:

    PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8, time_zone = '$timezone';"
    

    And it worked fine.

提交回复
热议问题