Search code examples
phpmysqlunicodecreate-table

CREATE MySQL TABLE in PHP with "utf8_unicode_ci"


I need to make a table in php, but i have to set up a "utf8_unicode_ci" coding. Iam using this code:

        mysql_query("CREATE TABLE `".$userreg."`(
        id INT NOT NULL AUTO_INCREMENT, 
        PRIMARY KEY(id),
        title VARCHAR(30), 
        rating_estimate INT NOT NULL) DEFAULT CHARSET=utf8")

but it builds "utf8_general_ci" table. Any advice how to create table in php with unicode coding? thx.


Solution

  • Add COLLATE=utf8_unicode_ci after the CHARSET=utf8 option