這ISDB連接,給出錯誤DBD :: mysql的:: ST fetchrow_array失敗:取()不執行()僅適用於DELETE語句
$DBH = DBI->connect("dbi:mysql:$DATABASE","$USER","$PASS",{ RaiseError => 1, AutoCommit => 1 }) or die "Connection Error: $DBI::errstr\n";
和下面的代碼,
$sth=$DBH->prepare("DELETE FROM sample where id=1 ") or warn $DBH->errstr;
$sth->execute or die "can't execute the query: $sth->errstr";
while(@row = $sth->fetchrow_array()){
$count+=$sth->rows;
}
的上面的代碼給了我的錯誤,
DBD :: mysql的:: ST fetchrow_array失敗:取()不執行()..
但是,當我使用select * from sample where id=1
然後它運行。它只給我錯誤delete statement
。爲什麼這樣? 幫助!感謝名單!
一個'delete'語句不返回任何行。它只返回已刪除的行數。 – Tensibai
@Tensibai我們可以計算刪除行 – Pranay
嘗試搜索文檔,我沒有做Perl,但我發現[this](http://search.cpan.org/~timb/DBI-1.633/DBI.pm#rows )在DBI文檔中。 – Tensibai