---
F R E N D Z of martian
---
I live in Spain and my address: C/ de l'Encarnaci� serious fucks SQL as
well.
The ' screws it up and so does the /. So I have a my favourite perl sub
of all time for you:
######################################################################
# Sub: strip_quotes
# Version: 1.0
# Description: replaces \, ' and " with \\, \' and \" respect.
# in order to insert text fields in database, these
# escape the string and make the SQL work.
#
sub strip_quotes {
my $text = shift;
$text =~s/\\/\\\\/gm;
$text =~s/\'/\\\'/gm;
$text =~s/\"/\\\"/gm;
return $text;
}
I love it, but Iain tells me there's a better way of doing this, but as
I wrote it, I'm gonna keep using it!
Mike.
P.S. I'm not a member, but I hope it's alright to send?
--
Mike Harris
Open Systems and Internet Consultant
Psand Espa�a, C/ de l'Encarnaci� 35 2� 2�
08012 Barcelona, Spain
Tel: +34 93 213 6872 / +34 69 676 3122
Website: www.psand.net
--
Sent to you via the frendz list at marsbard.com
The archive is at http://www.mail-archive.com/[email protected]/