0

I have defined valid characters set. eg. [a,b,c,d,.......A,B,C,D,,.............0,1,2,3,4,5,6,7,8,9] And I want to generate a RANDOM yet UNIQUE string in PHP .

Also i want to specify a length of output string. Like. Generate 5 digit output string from given character set.

How to achieve this?

  • Duplicate: http://stackoverflow.com/questions/4558707/case-sensitive-collation-in-mysql – MarkP Jan 14 '16 at 15:40

1 Answers1

0

On 5.6.13, the answer is:

mysql> SHOW COLLATION LIKE '%cs';
+--------------------+---------+----+---------+----------+---------+
| Collation          | Charset | Id | Default | Compiled | Sortlen |
+--------------------+---------+----+---------+----------+---------+
| latin1_general_cs  | latin1  | 49 |         | Yes      |       1 |
| latin2_czech_cs    | latin2  |  2 |         | Yes      |       4 |
| cp1250_czech_cs    | cp1250  | 34 |         | Yes      |       2 |
| latin7_estonian_cs | latin7  | 20 |         | Yes      |       1 |
| latin7_general_cs  | latin7  | 42 |         | Yes      |       1 |
| cp1251_general_cs  | cp1251  | 52 |         | Yes      |       1 |
+--------------------+---------+----+---------+----------+---------+
6 rows in set (0.00 sec)

or any *_bin Collation.

But first, what CHARACTER SET will you be using?

Rick James
  • 135,179
  • 13
  • 127
  • 222