For SELECT, you can use the FOUND_ROWS construct ( described here ):
SELECT SQL_CALC_FOUND_ROWS something FROM your_table WHERE whatever; SELECT FOUND_ROWS( ) ;
which will return the number of rows in the last SELECT query (or if the first query has a LIMIT , it returns the number of rows that would be without LIMIT ).
For UPDATE / DELETE / INSERT , this is a ROW_COUNT construct
INSERT INTO your_table VALUES (1,2,3); SELECT ROW_COUNT();
which will return the number of rows affected.
AndiDog Feb 09 '10 at 13:13 2010-02-09 13:13
source share