$sth = $dbh->prepare(" Update tUser Set ? = ? Where UserId = $user_info{UserId} "); foreach $key(keys %user_info) { if ($key ne "UserId") { $sth->execute($key, $user_info{$key}); } } $sth->finish(); #### DBD::mysql::st execute failed: You have an error in your SQL syntax near ''LastName' = 'Smith' Where UserId = 1 ' at line 2 at /usr/usr_update line 197.