问题描述
较早的mysql扩展名具有CLIENT_FOUND_ROWS
连接标记,但找不到 mysqli 的任何等效项.
The older mysql extension has the CLIENT_FOUND_ROWS
connection flag, but I couldn't find any equivalent for mysqli.
我有一个update
查询,想知道其where
子句匹配的行数,而不是实际更改的行数(如mysqli -> affected_rows
所示).
I have an update
query and want to know how many rows its where
clause matched, not how many were actually changed (as indicated by mysqli -> affected_rows
).
到目前为止,我发现的唯一方法是使用正则表达式解析mysqli -> info
(看起来像Rows matched: 40 Changed: 40 Warnings: 0
).但这似乎很骇人.
The only way I've figured out so far is to parse mysqli -> info
(which looks something like Rows matched: 40 Changed: 40 Warnings: 0
) with a regex. But that seems hacky.
推荐答案
它在 mysqli_real_connect
.
也在PHP 5.3中的PDO :: MySQL中引入.
Also introduced in PDO::MySQL in PHP 5.3.
这篇关于使用PHP mysqli获取UPDATE查询匹配的行数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!