One final question here on my SQL -- PERL DBI

the following is wrong -- it does not work !

$sql = qq|insert into $table_name values (null,now(),"$email","$name","$comments");|;
$sql = $dbh->quote($sql); ## this line
$sth = $dbh->prepare($sql);

if I do this:

$name = $dbh->quote(param('Name'));
$email = param('Email');
$comments = $dbh->quote(param('Comments'));

$sql = qq|insert into $table_name values (null,now(),"$email","$name","$comments");|;
$sth = $dbh->prepare($sql);

It works, it escapes \'s just fine but also adds 'around the text string'.
I just want to escape  \'s

I was using: 
     $value =~ s/'/\\'/g;  # escape 's

Wiggins d'Anconia suggested using DBI to do escape \'s. Did I miss something in the 
perldoc DBI ?

Good nite, 
     
Dave G.  1:20am in Ft. Worth

--
Rewards and punishments are the lowest form of education. 
-Chuang-Tzu, philosopher (4th c. BCE)



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to