如何通过pdo multi query

时间:2017-03-05 16:08:13

标签: php mysql pdo

我可以在phpmyadmin sql中成功完成此查询。但是,当我通过pdo执行此操作时,请回复此错误:

  

致命错误:未捕获PDOException:SQLSTATE [HY000]:D:\ xampp1 \ htdocs \ admin \ feak.php中的常规错误:15堆栈跟踪:#0 D:\ xampp1 \ htdocs \ admin \ feak.php(15 ):PDOStatement-> fetchObject()#1 {main}在第15行的D:\ xampp1 \ htdocs \ admin \ feak.php中抛出

include("inclode/class.inc.php");
$con = new connection();
$con->con->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
$stmt = $con->con->prepare("CREATE TEMPORARY TABLE Basket(temporary_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,ArtistName VARCHAR( 20 ),NAMEOfTheDVD VARCHAR( 30 ));INSERT INTO Basket( ArtistName, NAMEOfTheDVD) VALUES ( 'R', 'SHAWooSHANK');SELECT * FROM Basket;");
$stmt->execute();
while($fetch = $stmt->fetchObject()) {
    echo $fetch->NAMEOfTheDVD;
}

0 个答案:

没有答案