MySQL Forums
Forum List  »  Newbie

Re: Any other invalid characters I'm not aware of???
Posted by: Michael Douglass
Date: April 22, 2005 12:00AM

You don't list what language you are using, but if you have potentially questionable characters being inserted into the database, then you need to "escape" the string. The libmysqlclient library has "my_real_escape_string()" function (http://dev.mysql.com/doc/mysql/en/mysql-real-escape-string.html) that you can use to do that. If you are using perl, then you should simply do something like this:

my $sth = $dbh->prepare("INSERT INTO tablename (stringfield) VALUES (?)");
$sth->execute("My string with ' characters and the like");

The DBI/DBD magic will take care of you and esacpe the strings on your behalf.

MikeDoug

Options: ReplyQuote


Subject
Written By
Posted
Re: Any other invalid characters I'm not aware of???
April 22, 2005 12:00AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.