Hi everyone,
I'm running a script that is supposed to insert rows into a table, but
consistantly don't do so. I have tried both a prepare/execute and a do
statement, and neither work.
The weird thing is, I have a conditional die statement which should
print something if the execute fails, but this never works either. I've
tried printing the variables following the execute statement, so I know
they are defined and I also know the environment variables are correct.
This also happens with a delete statement but select queries work fine.
Could someone give me some pointers I could use for troubleshooting?
Some code snipets follow below.
Thanks,
-James
======================================
sub Print_Sites_Added_Page {
$sth_site_stuff=$dbh->prepare("
SELECT nvl(name, 'None'), type, url
FROM active
WHERE id = ?");
$sth_add_sites=$dbh->prepare("INSERT INTO user_sites
(userid, siteid, sitename)
VALUES (?,?,?)");
print &PrintHeader;
print p("<h3>Monitor Additional Sites:</h3>\n");
print $alert;
print hr();
print p("The following sites have been added:");
print start_form(-action => '/PA2-bin/monitored_sites.html',
-method => POST), "\n";
foreach $sid (@new_adds) {
$sth_site_stuff->execute($sid);
@row=$sth_site_stuff->fetchrow_array;
($site_name, $type, $url) = @row;
$sth_add_sites->execute($uid,$sid,$site_name) || die print
"Can't insert new site:<br>$DBI::errstr<hr> ";
print "<b>$type://$url</b><br>\n";
}
$sth_site_stuff->finish;
$sth_add_sites->finish;
print hidden("uid"),"\n";
print submit(-name => "option",
-value => "Continue"), "\n";
print end_form, "\n";
print &HtmlBot;
}