PHP, MySQL - can you distinguish between rows matched and rows affected?

后端 未结 2 1904
情书的邮戳
情书的邮戳 2020-12-06 05:44

I am trying to write a PHP-MySQL database processor that is somewhat intelligent. When this processor decides it needs to make an update, I want to report if it was really

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-06 06:24

    You can also use the function

    $variable = mysql_info();
    

    That function retrieves a string like this:

    Rows matched: 1 Changed: 0 Warnings: 0

    You can work with strings functions on your variable to extract the substring with the number of rows that matched and you should have it!

提交回复
热议问题