1

我得到一个奇怪的结果,以下是简单更新查询后 mysqli 对象的状态:

"UPDATE charstate SET name = '-', type = 'The Homemaker' WHERE gameno = 1"

如您所见,affected_rows = -1 但是...信息是“匹配行:3 已更改:3 警告:0”并且查询已更新数据库。我正在使用 mysqli->affected_rows 来检查返回 -1 并且测试失败但这是不正确的成功。

有任何想法吗?

mysqli object {
  affected_rows => (int) -1
  client_info => (string) mysqlnd 5.0.10 - 20111026 - $Id: 
  client_version => (int) 50010
  connect_errno => (int) 0
  connect_error => null
  errno => (int) 0
  error => (string)
  error_list => array(0)
  field_count => (int) 0
  host_info => (string) 127.0.0.1 via TCP/IP
  info => (string) Rows matched: 3  Changed: 3  Warnings: 0
  insert_id => (int) 0
  server_info => (string) 5.5.27
  server_version => (int) 50527
  stat => (string) Uptime: 11431  Threads: 6  Questions: 542  Slow queries: 0  Opens: 52  Flush tables: 1  Open tables: 2  Queries per second avg: 0.047
  sqlstate => (string) 00000
  protocol_version => (int) 10
  thread_id => (int) 114
  warning_count => (int) ...
4

1 回答 1

0

当使用“root”作为 mysql 用户登录名(无密码)时,会出现上述行为。当使用另一个用户时,affected_rows 被正确给出。

诡异的!似乎这是mysql或PHP中的某种错误。我不知道向谁或如何向谁报告。

于 2013-05-31T21:18:31.183 回答