Skip to content
Advertisement

PHP PDO: charset, set names?

I had this previously in my normal mysql_* connection:

JavaScript

Do I need it for the PDO? And where should I have it?

JavaScript

Advertisement

Answer

You’ll have it in your connection string like:

JavaScript

HOWEVER, prior to PHP 5.3.6, the charset option was ignored. If you’re running an older version of PHP, you must do it like this:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement