■ PDO で複数の SQL 文を連続実行するとエラーになる理由 PDO を使って、こんな感じのコードを書いていた。 $dbh = new PDO($dsn); $sql = "SELECT * FROM table1 WHERE id='$id'"; $stmt = $dbh->prepare($sql); $stmt->execute(); $row1 = $stmt->fetch(); $sql = "SELECT * FROM table2 WHERE id='$id'"; $stmt = $dbh->prepare($sql); $stmt->execute(); $row2 = $stmt->fetch(); ところが、実行すると以下のようなエラーが出て止まってしまう。 Fatal error: Call to a member function execute() on a