MySQL single and double quotes insertion

Share

More than often while inserting some description into MySQL from a form input one faces a ‘single and double quote’ problem. For example while inserting the following text –

I have both ‘ and ” quotes in my description

To make the text safe for a MySQL insertion parse it with mysql_real_escape_string()

That would make it MySQL safe and would insert the correct text.

This entry was posted in MySQL, PHP and tagged , . Bookmark the permalink.
 

2 Responses to MySQL single and double quotes insertion

  1. Pingback: Handle Quotes In MySQL Query Using Zend Framework | Web Funda

  2. Lauty says:

    Isn’t it better to edit the trasalnte text as normally, even if Modules are not 100% trasalnted the developer use __( bla bla’) and all we need is to add the default text as a new line in the localized file and enter the localized text?I do this as I fell safer that reading from DB.I had problems that I localized using this feature and some strings were not localized arghhh Magento why r u so difficult!

Leave a Reply

Your email address will not be published. Required fields are marked *

*