beginTransaction(); $query = "INSERT INTO comments ('id','album','book','paragraph','text','user','time') VALUES (NULL,?,?,?,?,?,?)"; $stmt = $PDO->prepare($query); $newData = array($album, $book, $paragraph, $text, 4, time()); $stmt->execute($newData); // 提交更改 $PDO->commit(); if (!$stmt || ($stmt && $stmt->errorCode() != 0)) { $error = PDO_ErrorInfo(); echo "error - $error[2]
"; } else { echo "updata 1 recorders."; }