Rella
Rella

Reputation: 66995

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

How to prepare Cyrillic 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?

Upvotes: 1

Views: 115

Answers (1)

Mark
Mark

Reputation: 6228

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;

Upvotes: 1

Related Questions