Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将删除的行作为对象返回?我是否必须查询它们,删除它们,然后将删除的 id 与查询的 id 进行比较,还是有内置的方法?
* 我不想删除多少行,我想要行的值
将 PDO 与 MySql 一起使用,并将行作为“媒体”类返回。
寻找从数据库中删除行的替代方法通常有充分的理由。听起来您可能已经发现了这一点。您是否考虑过添加“标志”,例如 removed = 1 或 0 ?
您需要在删除它们之前查询这些行。UPDATE、INSERT 和 DELETE 仅返回受影响的行数值。您可能可以使用触发器扩展此功能,但就个人而言,这可能是矫枉过正。