in reply to Mysql update table problem

Haven't gone through your code but here are a few tips

  1. Use DBI error messages to understand the problems, e.g. $sth = $dbh->prepare($query) || die $DBI::errstr or $sth->execute() or die $DBI::errstr
  2. Use debugger "perl -d"
  3. If you are not comfortable with debugger sometimes you can even use print statements to check the progress. Error in "prepare" will result in undefined statement handle
  4. And finally after you have done all above, if you are still not able to understand the problem try to put only part of the code where you actually see the problem

I hope the very first option will solve your problems

Replies are listed 'Best First'.
Re^2: Mysql update table problem
by jb22 (Initiate) on Nov 09, 2010 at 15:07 UTC
    I still can't find where the problem lies. I select the right fields with my first query, I copy the data into the right table with the second query. What I need to do then, is update the first table (using two specific columns), so that the data that are already used won't be used no more. For every selected data, I have to update the column "assigned" and the column "evaluated" with a number, obviously just for data that are selcted by the first query. I don't know how to do it. I tried what you suggested but with no success.

      Check for the return value of "execute". If transaction is successful it should return the number of affected rows. Otherwise it will set the variable $DBI::errstr.

      Also have a look at "RaiseError"

      Do post what you have done and what you got.

        Thanks, I finally got around it and now it works.