"robert.waters" <> writes:
> I've done as much research as I can (google, perldocs, cgi faqs) but I
> am at a stand-still.
You might want to google for "SQL Injection". Directly interpolating vars
into SQL strings can be problematic - you should use placeholders to help
avoid that. They also give a nice performance boost if you're repeating the
same query with different data.
> example query:
> "INSERT INTO (field) VALUES ($cgiobj->param('cgi-parameter'))"; where
> 'field' is varchar and parameter should be able to include any text.
Using placeholders:
# Assuming the database handle $dbh has already been connected
my $sth = $dbh->prepare('INSERT INTO(field) VALUES (?)');
# I'm skipping over error-checking here for brevity - don't skip
# it in production code!
$sth->execute($cgiobj->param('cgi-parameter'));
This allows no chance for the contents of 'cgi-parameter' to be interpreted
as part of a SQL command.
sherm--
--
Cocoa programming in Perl:
http://camelbones.sourceforge.net
Hire me! My resume:
http://www.dot-app.org