in reply to Re^4: Increment DB using Perl
in thread Increment DB using Perl

Well the UPDATE statement is scoped to UPDATE all rows, each time through the loop. You need a WHERE clause on it. But I still don't understand what the $pointer loop has to do with the update loop. Which rows are you trying to update? What belongs in the WHERE clause?

Replies are listed 'Best First'.
Re^6: Increment DB using Perl
by Anonymous Monk on Mar 08, 2005 at 16:55 UTC
    Just the row "ID", nothing else, just need the code to run and insert numbers starting from 0 to whatever is the last row in the table from the database.
      Now you've really lost me. Which rows do you want to update? What should the XXX in this be?: UPDATE request SET ID=$newid WHERE XXX
        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.