How to find out how many records I deleted? For example, with this request

DELETE FROM `table` WHERE `id` > 100 

    2 answers 2

     <?php if(mysql_query("DELETE FROM mytable WHERE id = 25")) { echo (mysql_affected_rows()); } ?> 

    mysql_affected_rows () - returns the number of rows affected by the last INSERT, UPDATE, DELETE.

    • it is time to stop using api mysql_ - nolka
    • @nolka yes here rather as an example than a working solution. PDO: docs.php.net/pdostatement.rowcount - lampa
    • 3
      And where did you get that question about php? - sercxjo
    • one
      And where did you get that the question is not about php? - nolka
     SELECT ROW_COUNT(); 

    after removal. reference to the documentation