gpt4 book ai didi

php - 如何使用 mysqli dbdriver 知道行是否被删除

转载 作者:行者123 更新时间:2023-11-29 06:08:32 24 4
gpt4 key购买 nike

我正在使用 codeigniter 2.1.0 和 mysqli dbdriver。我有以下查询,想知道何时成功

$query = $this->db->query("delete FROM abc WHERE id IN (" . $IdList . ")");

如何知道相关行是否被删除?

最佳答案

$this->db->affected_rows() 就是您要查找的内容。您应该能够将该结果与预期的已删除行数进行比较。

同时引用USER GUIDE

Displays the number of affected rows, when doing "write" type queries (insert, update, etc.).

Note: In MySQL "DELETE FROM TABLE" returns 0 affected rows. The database class has a small hack that allows it to return the correct number of affected rows. By default this hack is enabled but it can be turned off in the database driver file.

关于php - 如何使用 mysqli dbdriver 知道行是否被删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10296818/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com