Using str_split on a UTF-8 encoded string

前端 未结 7 1553
天命终不由人
天命终不由人 2020-11-29 00:37

I\'m currently working on a project, and instead of using regular MySQL queries I thought I\'d go ahead and learn how to use PDO.

I have a table called contestants,

7条回答
  •  时光取名叫无心
    2020-11-29 01:07

    UTF-8 Using PDO

    problems when writing international (even Chinese and Thailandic) characters to the database

    there may be more ways to make this work. I am not an expert, just a tech-freak, interested to understand all this. In Linux and Windows I have set up a few CMS (content-managing-systems), using a sample from the following website:

    'http://www.elated.com/articles/cms-in-an-afternoon-php-mysql'

    The sample is using PDO for insert, update and delete.

    It took me a few hours to find a solution. Whatever I did, I always concluded differences between the data in my forms and in the phpmyadmin/heidi -views

    I followed the hints of: 'https://mathiasbynens.be/notes/mysql-utf8mb4' but there was still no success

    In my CMS-structure there is a file 'Config.php': After reading this webpage I changed the line

        define( 'DB_DSN', 'mysql:host=localhost;dbname=mythings);
    

    to

        define( 'DB_DSN', 'mysql:host=localhost;dbname=mythings;charset=utf8');
    

    Now all works fine.

提交回复
热议问题