Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ROW_COUNT returns 0 after INSERT or UPDATE

Tags:

mysql

I have a PHP project that uses Pear DB to deal with MySQL database. One of the functions inside of that project relies on a result of SELECT ROW_COUNT() to find out number of rows affected by certain SQL statement. On MySQL 5.1 ROW_COUNT() behaves as expected, whilst on 5.5 it always returns 0.

I have also tried performing an insert through MySQL Workbench and executing SELECT ROW_COUNT() and it also returns 0. Although, doing same thing through MySQL cli, works fine!

Anybody stumbled upon this?

Thanks!

like image 276
spacemonkey Avatar asked Oct 01 '12 13:10

spacemonkey


1 Answers

The behaviour of row_count() has changed in MySQL 5.5. For more Information see the MySQL RefMan for row_count().

like image 144
mhutter Avatar answered Sep 30 '22 19:09

mhutter