Does anyone know of an available function that you can pass a string to and receive back the string altered (if need be) into the proper syntax (ie, escaped characters) to work with a MySQL query?

For those familiar with the Perl DBI module, I need something similar to $dbh->quote();

Thanks in advance