views:

20

answers:

1

How to prepare Cyrilic and other variables for storing into MySql DB? (PHP)

So I need realy simple way to prepare recived from browser $_GET[string] variables for storing into DB.

How to do such thing?

+1  A: 

You shouldn't need to make any modifications to the strings at all. But you will want to ensure your database and table encoding are set to utf8. Normally they default to latin1.

Also, when pulling data from the database later on, you will want to set the connection encoding to utf8 before making any other queries. You do this by executing the query:

SET NAMES utf8;
Mark