in reply to Re: Finding local vs Global Error
in thread Finding local vs Global Error
$sth2 = $dbh->prepare( 'insert into catalog values ($words, $index{$words})' );Perl won't interpolate $words because it's inside single quotes. If $words is a string variable, even if it were interpolated, it wouldn't be proper SQL because string values need single quotes around them (in the SQL, not in the Perl). Easiest and best fix is placeholders:
$sth2 = $dbh->prepare('INSERT INTO catalog VALUES(?,?)'); $sth2->execute($words,$index{$words});
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Finding local vs Global Error
by Cappadonna3030 (Sexton) on Sep 21, 2005 at 01:15 UTC |