ID is the name of the row to be updated and variable $newid should be the new id number to be inserted into the database table, so every time in the while loop the first row should be inserted with a 0 and all the rest of the rows should get incremented values 1 for the second row 2 for the third row until the end of the rows on the table.