Treehunter has asked for the wisdom of the Perl Monks concerning the following question:

$db->Sql("UPDATE USERACCOUNT set TIME = $block_time WHERE USERNAME = ' +$name'");
TIME is an Numeric value and i can't seem to change it with this. Any one see any thing wrong?

Replies are listed 'Best First'.
Re: Win32::ODBC Numeric Update
by davidrw (Prior) on May 22, 2005 at 16:42 UTC
    Can you give a few more details?
    • What database is it going against? Is 'TIME' a reserved word that you have to quote as a column name?
    • What are values of $block_time and $name? (or really, of the actual constructed sql string) (are there quotes in $name or something like that?)
    • Are you sure the db connection is open?
    • What does $db->Error() have in it?

    As a side note, you could be using DBD::ODBC instead -- one huge advantage is it's (DBI's) use of placeholders:
    $dbh->do("UPDATE USERACCOUNT set TIME = ? WHERE USERNAME = ?", {}, $ +block_time, $name);
Re: Win32::ODBC Numeric Update
by kwaping (Priest) on May 23, 2005 at 02:16 UTC
    ++ to the above post. In addition, you could try this:
    $block_time =~ tr/0-9//cd;