There are various escaping methods for various applications. MySQL will require escaping of command characters, however this is generally an issue with PHP - where a string is manipulated in to allowing these command characters to change the meaning of the query.
If you use bound (prepared) statements you can "universally" bypass issues like this so that they are useless to the database command language. Verifying if "johnny 'a = foo" is a proper name however to be stored, is up to you, however it will do no harm.
For a client side web browser, a name such as <big>Rupert</big> will be an issue, so an HTML entity translation can help - however you will be bloating your database with useless entities. If you have rich documents with a lot of formatting, converting to entities beforehand may bloat the database - you may wish to do this each page load if available data is a commodity.
Quote
also is there a reverse function for mysql_real_esc... that I can call before outputting the data onto a webpage??
If used properly, it will render an apostrophe or quote as an apostrophe or quote. If you were to "reverse" this behaviour on the resulting page, you will be stripping every valid quotation as they are the same as before escaping.
You may wish to modularise your global escaping functions, keep database escaping to one function, entity escaping to another, etc. only if there is significant work to justify a custom wrapping function.
Alexander.
Be sure to read the updated
FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us
why or
what errors occurred.