hi, there
Im fairly new to Perl/DBI/Sql stuff and im working on an assignment and I came across a problem when I try to insert a new record I get an error.
The reason I delete the record first is cause it a edit function so I dont want an duplicate primary keys.
I tried a few differnt things one of them being, comment out the 4 line that are for the INSERT and the row gets delete fine no errors once I uncomment i get the following error
Can't locate object method "perpare" via package "DBI::db" at /srv/www/cgi-bin/admin.pl line 44.
$sql = "delete from tools where prodid=" . "'" . $prodid . "'";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth->finish();
$sql = "insert into tools (prodid, prodname, proddesc, price, company) values('" . $prodid . "', '" . $prodname . "', '" . $proddesc . "', '" . $price . "', '" . $company . "')";
$sth = $dbh->perpare($sql); <------- line 44
$sth->execute();
$sth->finish();
the db gets disconnect futher down the script
Thanks in advanced
Jamie
Im fairly new to Perl/DBI/Sql stuff and im working on an assignment and I came across a problem when I try to insert a new record I get an error.
The reason I delete the record first is cause it a edit function so I dont want an duplicate primary keys.
I tried a few differnt things one of them being, comment out the 4 line that are for the INSERT and the row gets delete fine no errors once I uncomment i get the following error
Can't locate object method "perpare" via package "DBI::db" at /srv/www/cgi-bin/admin.pl line 44.
$sql = "delete from tools where prodid=" . "'" . $prodid . "'";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth->finish();
$sql = "insert into tools (prodid, prodname, proddesc, price, company) values('" . $prodid . "', '" . $prodname . "', '" . $proddesc . "', '" . $price . "', '" . $company . "')";
$sth = $dbh->perpare($sql); <------- line 44
$sth->execute();
$sth->finish();
the db gets disconnect futher down the script
Thanks in advanced
Jamie