Jump to content

Tiny Int


otuatail

Recommended Posts

Still having problems with the int data types

 

The Mysql server states the value in brackets is optional but can be larger tha n required. int() can be int(4) ant tinyint can be tinyint(1), but when I add the field through phpmyadmin it gives me tinyint(4). Also leaving the number out creates an error.

 

Desmond.

 

Link to comment
https://forums.phpfreaks.com/topic/77286-tiny-int/#findComment-391541
Share on other sites

My table and page work fine. I am just confused over the values in brackets

 

DROP TABLE IF EXISTS `thread2`;
CREATE TABLE IF NOT EXISTS `thread2` 
(
  `id` int(11) NOT NULL auto_increment,
  `owner_id`  smallint(2) UNSIGNED,
  `CreateDate` int(4) UNSIGNED,
  `UpdateDate` int(4) UNSIGNED,
  `Cat` tinyint(1) UNSIGNED,
  `Visible` tinyint(1) UNSIGNED,
  `Writable` tinyint(1) UNSIGNED,
  `Pinable` tinyint(1) UNSIGNED,
  `View` smallint(2) UNSIGNED,
  `Reply` smallint(2) UNSIGNED,
  `subject` char(200),
  PRIMARY KEY  (`id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;

If Ileave them out I get a table creation error. Also if I add a field tinyint using PHPmyadmin it apears as tinyint(4) not tinyint(1)

 

 

Link to comment
https://forums.phpfreaks.com/topic/77286-tiny-int/#findComment-391553
Share on other sites

Confusion! what is the size of a tinyint mysql.com manual states one byte. and can be

tinyint() or tinyint(1). I have used the latter.

PHPmyadmin [Add field to end of table] reveals a structure tinyint(4) //tiny int 4 bytes?

 

And to add more confusion to this. The manual states that not only can you have

smalint(2) but you can have smallint(3). The explanation is not clear but asumes you can exceed the maximum.

 

 

Link to comment
https://forums.phpfreaks.com/topic/77286-tiny-int/#findComment-391566
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.