tables in my database where are some unusual letters from czech alphabet like ěščřžýáíé ignore my query. I think it could be solve via CHARACTER SET utf8 COLLATE utf8_czech_ci, but it looks like i dont know how to use it. Iam trying this code, but for sure, there is some problem:
mysql_query("CREATE TABLE `".$userreg."` CHARACTER SET utf8 COLLATE utf8_czech_ci(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
title VARCHAR(30),
rating_estimate INT)")
or die(mysql_error());
I have to create table in PHP code, because it depends on another variables. Browser shows "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), title VARCHAR(30), ' at line 2".
Any idea how to fix?
CHARACTER SET utf8 COLLATE utf8_czech_ci
需要在结束')'之后位于CREATE
语句的末尾
You can use mysql_set_charset()
mysql_set_charset('utf8');//or utf8_czech_ci
Or:
mysql_query("SET character_set_results=utf8");
You can also ALTER
your table:
ALTER TABLE tbl_name CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
However, it is suggested to see Why shouldn't I use mysql_* functions in PHP?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.