Hi,
The question appears if your data is reset in database after transaction or during transaction. If after transaction is the case then you should take care on commit mechanism of transaction. Some database interfaces or databases can be set to so called auto-commit where commit is issued to database after every sql dml cluase ( insert, update, delete). If that's not the case then after disconnecting from the DB rollback is issued and no change of data is done. Hope this is in your direction ... Kind Regards Ivan Drvaric |---------+----------------------------> | | "FLAHERTY, | | | JIM-CONT" | | | <Jim.Flaherty@cne| | | t.navy.mil> | | | | | | 06/03/2002 03:59 | | | AM | | | | |---------+----------------------------> >---------------------------------------------------------------------------------------------------------------------------------------------| | | | To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> | | cc: | | Subject: What am I doing wrong... I want to increment a number in a DB | >---------------------------------------------------------------------------------------------------------------------------------------------| I have a query to draw it out on my redhat 7.1 box with MySQL 3.23 and I increment it and run update query . Some where it resets back to zero all the time the code foreach $row(@$array_ref) { my($num,$title,$media,$serial,$time,$class,$remarks,$custody,$loc, $format,$qty,$lab,$rew,$sta,$history5,$check) = @$rows; $history2 = $history5; $history2++; } $dbh2 =DBI ->connect($data_source, $username, $password); my $sth2 = $dbh2 -> prepare("update media1 set history5 ='$history2' where num = '$num'"); $sth2 -> execute or die " unable to execute query "; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]