Hi Jennifer, In most cases, it's best to use int. The difference between the two is simply the range of numbers they can show. Tinyint is fine for cases where you know you'll never need more than 127 (or 255 if you tell MySQL that it is an UNSIGNED tinyint, which just means that it can't have negative numbers so it now has that much more room for positive numbers; the UNSIGNED literally means that it doesn't have a positive or negative sign, so everything's defaulted to positive). If you use a regular tinyint on an auto-incrementing field like "member_id" and you get 127 members, you won't get any more. Each attempted INSERT query after the 127th member will have an error saying something about duplicate keys for 127 (it's trying to insert a new one, but it can only go up to 127, so it tries to insert a new member with an id of 127, but there's already one there).
So in short, use int in most cases. It doesn't take up that much more space, and has a much wider range of numbers it can hold (someone else said 2 billion-something, which I think is right). But from what I currently understand (someone can correct me if I'm wrong), you are also limited to the digits/length you specify for the field. For instance, an int(5) can only hold 5 digits, so you could go up to 99,999 maximum and down to -99,999 (unless you had an UNSIGNED int, in which case, there would be no negative numbers, but you're still limited to 5 digits). An int(6) could hold 6-digit numbers up to 999,999, etc... - Jonathan -----Original Message----- From: Jennifer Downey [mailto:[EMAIL PROTECTED]] Sent: Sunday, March 31, 2002 10:06 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] int or tinyint Hi all, Just a simple question (I think). When should I use tinyint over int. and what is the difference between the two? Thanks Jennifer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php