this one has been driving me nuts!! Below is a snip of code within a eval { } for transactions.
Everything gets inserted correctly but for some reason the $ary_ref->[$i] values are always '0', they should be the `signupid` values from the `subscriptions` table.
In the 1st INSERT statement the auto_increment values (signupid) are created correctly(in this code, 2 values, IE. 12,13) but when I go to retrieve these two values in the SELECT statement, it always returns '0', $ary_ref->[$i]. The @sitedata array has 2 lines of data(the $totalsubs equals '2' also) , and everything is inserted correctly from the @insertdata into the INSERT statement into the `site_subscriptions` table.
No errors are generated within the eval {} and once the transaction is commited, all goes exactly as it should, but for the life of me,... I can't figure out why the $ary_ref->[$i] keeps inserting a '0' value?? Any help, ... suggestions would be appreciated. :)
#################################################################################
$sql = qq|INSERT INTO subscriptions (signupid,siteid) VALUES (NULL,?)|;
for (1..$totalsubs) { $dbh->do($sql,undef,$siteid); }my $subsql = qq|SELECT signupid FROM subscriptions WHERE siteid = $siteid|; my $ary_ref = $dbh->selectall_arrayref($subsql); my $sql = qq|INSERT INTO site_subscriptions $sitecols VALUES $siteplaceholder|;
for (my $i; $i<@{$ary_ref}; $i++) {
chomp $sitedata[$i];
my @insertdata = split(/\|/,$sitedata[$i]); # HERE THE $ary_ref->[$i] ALWAYS INSERTS '0' here
$dbh->do($sql,undef,$ary_ref->[$i],@insertdata);
}
##################################################################################-- Mike<mickalo>Blezien =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Thunder Rain Internet Publishing Providing Internet Solutions that work! http://www.thunder-rain.com Quality Web Hosting http://www.justlightening.net MSN: [EMAIL PROTECTED] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
