Gossamer Forum
Home : General : Perl Programming :

Can't locate object method "perpare" via package "DBI::db" help plz!

Quote Reply
Can't locate object method "perpare" via package "DBI::db" help plz!
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
Quote Reply
Re: [fooforon] Can't locate object method "perpare" via package "DBI::db" help plz! In reply to
You have a typo - change:

$sth = $dbh->perpare($sql);

to:

$sth = $dbh->prepare($sql);

----
Cheers,

Dan
Founder and CEO

LionsGate Creative
GoodPassRobot
Magelln
Quote Reply
Re: [dan] Can't locate object method "perpare" via package "DBI::db" help plz! In reply to
Thanks

typos always get me in so much trouble

Jamie