Here are a few possibilities:
& Rdquo; If you have an AUTO_INCREMENT column, you can select the row number before and after insertion
& Rdquo; SELECT ROW_COUNT() returns the number of rows modified, deleted, or inserted by the last statement if it was UPDATE , DELETE or INSERT ( doc )
& Rdquo; You can use mysqli_affected_rows (since mysql_ functions mysql_ deprecated) to get the number of rows affected in a previous MySQL operation ( doc )
$link = mysqli_connect("localhost", "my_user", "my_password", "world"); if (!$link) { printf("Can't connect to localhost. Error: %s\n", mysqli_connect_error()); exit(); } /* Insert rows */ mysqli_query($link, "INSERT INTO myTable VALUES (1)"); printf("Affected rows (INSERT): %d\n", mysqli_affected_rows($link));
source share