Jump to content

Which Collation??


shenniko

Recommended Posts

Hi guys,

Pretty new to MySQL, ive mainly been using Access DB to do most of my Database work.

I've started building a PHP site with MySQL, and im a little stuck..

Which Collation should i be using? and whats the differance? Im using phpadmin to create all my MySQL tables and at the moment my database is auto setting the Collation to "latin1_swedish_ci".

Also, on a side note,

For my user profiles, im using TINYINT.. would that mean the max number of users it would go upto would be 9999? and if so would it be better for me to change it to BIGINT? (if i expect more than 9999 users to join my site?)

Thanks in advance

Shenn
Link to comment
https://forums.phpfreaks.com/topic/3342-which-collation/
Share on other sites

You're fine with default collation. That is for supporting other languages that have different alphabets (like Chinese with their thousands of little drawn characters). If all your stuff is English, don't worry about it.

TINYINT has a maximum value of 128 signed or 256 unsigned. I would recommend you use SMALLINT UNSIGNED, which is about 65000. If you expect to (eventually) have over 65000 users, use MEDIUMINT UNSIGNED, for a maximum of nearly 17 million.
Link to comment
https://forums.phpfreaks.com/topic/3342-which-collation/#findComment-11420
Share on other sites

UNSIGNED means that you KNOW the number will always be a positive number. Then MySQL knows that it can store from 0 to 65000 instead of from -32000 to 32000.

UNSIGNED ZEROFILL you shouldn't have to worry about, it makes it so that when you query the value, you get something with lots of leading zeros. So if you have length set to 5 and 32 is the value in the database, MySQL returns "00032".
Link to comment
https://forums.phpfreaks.com/topic/3342-which-collation/#findComment-11469
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.