tinyint field column value constantly resets to "127", why?

tinyint field column value constantly resets to "127", why?

am 01.06.2006 23:25:05 von phillip.s.powell

For some bizarre reason, each time I insert or update a row in my table
`image`, the field value for "image_width" is fixed at 127, no matter
what value I use!

Here is the schema:

CREATE TABLE /*! IF NOT EXISTS */ image (
id int not null auto_increment,
primary key (id),
image_path varchar(255) not null,
image_url varchar(255) not null,
image_width tinyint not null,
image_height tinyint not null,
image_alt_text varchar(255),
record_entered datetime,
unique_key varchar(20) not null
) /*! TYPE=MyISAM */;

I've tried PHPMyAdmin all the way to command-line MySQL, to no avail;
the image_width value constantly resets itself to "127", all other
vlues are fine.

Why would this happen?

Phil

Re: tinyint field column value constantly resets to "127", why?

am 02.06.2006 03:30:48 von Bill Karwin

phillip.s.powell@gmail.com wrote:
> For some bizarre reason, each time I insert or update a row in my table
> `image`, the field value for "image_width" is fixed at 127, no matter
> what value I use!

Tinyint is a 1-byte signed datatype; it has a range of -128 to 127.

http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html

Regards,
Bill K.

Re: tinyint field column value constantly resets to "127", why?

am 02.06.2006 16:35:26 von phillip.s.powell

Yeah sorry but 1 byte doesn't translate for me, I've never understood
bit-vs-byte no matter how much it's explained to me.

I changed "tinyint" to "smallint" and it's fine now, thanx

Phil

Bill Karwin wrote:
> phillip.s.powell@gmail.com wrote:
> > For some bizarre reason, each time I insert or update a row in my table
> > `image`, the field value for "image_width" is fixed at 127, no matter
> > what value I use!
>
> Tinyint is a 1-byte signed datatype; it has a range of -128 to 127.
>
> http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html
>
> Regards,
> Bill K.