> If you want them set to NULL using DBI, you have to bind undef to the
> proper parameter. Is that what you're doing, or are you binding
> something else, such as 0 or the empty string?
>
No the initial values in the DB are set to null, with the exception of one field. I'm
trying to assign the correct values to each field as I iterate through the rows.
However after runnign the script the values either remain at null or 0 in the caase of
an intiger. I'm reposting a clearer version of the script which actually has remarks
sub write_db_2 { #updates specified table in a dump fasion using a hash table
my ($ar_info,$table) = @_;
my ($dbh,$sth,$k,$rh_row);
$dbh = connect_try("*******","******");
foreach $k (keys (%{$ar_info->[1]})){ # retrieves a generic set of fields and uses
them to assign values for each row.
if ($table eq "prop_info"){ # checks which table is being used and assigns the
correct SQL statement
$sth = $dbh->prepare ("UPDATE prop_info
SET $k = ?
WHERE prop_str_addr = ?;") or
err_trap("failed to prepare statement\n");
}elsif ($table eq "own_info"){
$sth = $dbh->prepare ("UPDATE own_info
SET $k = ?
WHERE own_str_addr = ?;") or
err_trap("failed to prepare statement\n");
}
foreach $rh_row (@$ar_info) { # iterates through the list of rows and assigns
the correct value to the field
print "::$k=>$rh_row->{$k}"; # this is an internal check to verify what
values are being inserted
$sth->bind_param (1,$rh_row->{$k});
if ($table eq "prop_str_addr") {
$sth->bind_param (2,$rh_row->{prop_str_addr});
}elsif ($table eq "own_str_addr") {
$sth->bind_param (2,$rh_row->{own_str_addr});
}
$sth->execute() or
err_trap("failed to execute statement\n");
}
print "\n===========================\n";
}
$sth->finish();
$dbh->disconnect or
err_trap("failed to disconnect statement\n");
}
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]