Reputation: 65
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.
Upvotes: 3
Views: 9439
Reputation: 2006
add this part after column set :
DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
in your case :
"CREATE TABLE `".$userreg."`(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
title VARCHAR(30),
rating_estimate INT NOT NULL) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci "
Upvotes: 1
Reputation: 51
try it:
CREATE TABLE t (c CHAR(20) CHARACTER SET utf8 COLLATE utf8_bin);
Upvotes: 0
Reputation: 2765
Add COLLATE=utf8_unicode_ci
after the CHARSET=utf8
option
Upvotes: 6