This is just an offer. I am not saying that this is the best solution. Just think it over.
You are fulfilling your removal request.
DELETE FROM table_name WHERE Row IN (2,3);
After deletion, you make a request for a selection request using PHP and get a data set into an array.
SELECT Row, Name from table_name ORDER BY Row ASC;
Then do the UPDATE using a loop.
$index = 1; foreach($dataset as $item) { // Your update query $sql = "UPDATE table_name SET Row=$index where Name='" . $item['Name'] . "'"; $index++; }
Before embedding the following query, you should get the maximum row value and set the value to +1 as the insert query row. This is just an idea. Not a complete code.
source share