The move from PHP 5 to PHP 6 will be a painful one. But once it’s done, I hope that it will be easier to handle safe web development for a global, multi-language internet. After all these years, we still … Continue reading →
Feb
19
2009
Nov
26
2006
When using a uniqie index on a text field in mysql, the column collation setting is very important. The collation settings of a column does not only affect sorting and comparsion, but also unique indexes. So you can not insert "a" and "A" into a table that has a unique index on a column that has a case-insensitive collation. The mysql manual about collations: "A character set is a set of symbols and encodings. A collation is a set of rules for comparing characters in a character set."
Here is an example:
The column text in table text1 has a case-sensitive collation
(_cs suffix), the column in text2 has a case-insensitive
collation (_ci suffix).
PLAIN TEXT CODE:
- CREATE TABLE text1 (
- `text` varchar(50) character set latin1 collate latin1_general_cs NOT NULL …