DBI: 1.39 DBD::mysql: 2.9003 MySQL Version: - 4.0.15-standard Perl ver.: 5.8.0 RedHat/Linux 9.0
thx's -- Mike<mickalo>Blezien =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Thunder Rain Internet Publishing Providing Internet Solutions that work! http://www.thunder-rain.com =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Keith Jackson wrote:
What version of DBD/DBI are you using and on what platform? The exact same thing happened to me on SunOS (don't remember the exact DBD/DBI version). I upgraded to the lastest DBD/DBI and the problem went away.
HTH,
Keith
On Thu, 2004-01-08 at 11:40, Mike Blezien wrote:
Hello all,
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); } ##################################################################################
