Results 1 to 3 of 3
1) if i dont wont to have a problems with Unicode (when i conntect information from database in PHP) Where should I write "CHARACTER SET utf8 COLLATE utf8_general_ci?".
whre should ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 12-10-2010 #1Just Joined!
- Join Date
- Nov 2010
- Posts
- 8
SQL problems with UNIXODE
1) if i dont wont to have a problems with Unicode (when i conntect information from database in PHP) Where should I write "CHARACTER SET utf8 COLLATE utf8_general_ci?".
whre should i Write this code when I Creat DATABASE OR TABLE?
2) should i write down this 2 code In php file?
3) what is diference between this codes? which is good and bed and why?Code:mysql_query("SET CHARACTER SET utf8"); mysql_query ("SET NAMES 'utf8'") ;
For example My SQL code is like this:
is my code Correct?
Code:CREATE DATABASE `VakhoQ` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; CREATE TABLE `VakhoQ`.`C_lessons` ( `id` INT( 5 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , `title` VARCHAR( 225 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL , `description` VARCHAR( 225 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL , `text` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ) ENGINE = MYISAM ////////////////////////////
I have Creted Database named "vakhoQ"
then I make table c_lessons with "id", "title", "Description", and "text"
- 12-10-2010 #2
SET NAMES utf8 is a shortcut for
whereas SET CHARACTER SET utf8 is a shortcut forCode:SET character_set_client = utf8; SET character_set_results = utf8; SET character_set_connection = utf8;
You see, they are basically the same, but SET CHARACTER SET also sets collation_connection (which again sets character_set_connection implicitly). For more information about what these directives mean, please read the manual.Code:SET character_set_client = utf8; SET character_set_results = utf8; SET collation_connection = @@collation_database;
SET CHARACTER SET can cause some problems when handling data of different character set, so normally you would just use SET NAMES. You should not use both. In either case, the directive has to be the very first query sent after opening the connection.Refining Linux Advent calendar: “24 Outstanding ZSH Gems”
- 12-10-2010 #3Just Joined!
- Join Date
- Nov 2010
- Posts
- 8
thanks a lot!
now, i know that i should use "SET NAMES utf8" In php file.
but will i write in SQL lite "CHARACTER SET utf8 COLLATE utf8_general_ci" when I creat Database and Table?
Dose the the both (tabe and database) need " CHARACTER SET utf8 COLLATE utf8_general_ci" ?


Reply With Quote
