Jump to content


Photo

Error 1265: Data truncated for column 'xyz' at row 1


  • Please log in to reply
2 replies to this topic

#1 aesir5

aesir5
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 03 May 2006 - 03:10 PM

When my php script tries to submit my query, I get:

[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]Error 1265: Data truncated for column 'data15' at row 1[!--colorc--][/span][!--/colorc--]

My query looks something like this:

INSERT INTO table1 (
submit_date, 
data1, 
data2, 
data3, 
data4, 
data5, 
data6, 
data7, 
data8, 
data9, 
data10, 
data11, 
data12, 
data13, 
data14, 
data15, 
data16, 
data17, 
data18, 
data19, 
data20, 
data21) VALUES (
'2006-04-29 12:50:07', 
'300000', 
'2', 
'400000', 
'1', 
'good', 
'yes', 
'275000', 
'7', 
'Rick', 
'James', 
'234-235-6434', 
'', 
'first', 
'', 
'', 
'rjames@email.com', 
'25432 Bundy Drive', 
'Los Angeles', 
'CA', 
'90007', 
'')

As you can see, data15 is a blank value (''). When setting up the database, the field was created with:

ENUM("first", "second", "third", "fourth"),

data13 is exactly the same, but it is not a blank value, as indicated above. I've looked in the MySQL 5.0 documentation and it says that you can have blank values for ENUM data. It gives the example ENUM(one, two, three) and says that it would allow NULL, '', 'one', 'two', and 'three' as values. So I can't figure out what going on here, and can find very little info on this error.

Some help on this would be much appreciated. Thanks.

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 03 May 2006 - 05:26 PM

It says it will allow "NULL".... you're sending an empty character. That is not a null.

Info: PHP Manual


#3 aesir5

aesir5
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 03 May 2006 - 09:02 PM

[a href=\"http://dev.mysql.com/doc/refman/5.0/en/enum.html\" target=\"_blank\"]http://dev.mysql.com/doc/refman/5.0/en/enum.html[/a]

According to that documentation, it will allow an empty string. More precisely, it states:

[!--fonto:Lucida Console--][span style=\"font-family:Lucida Console\"][!--/fonto--][!--coloro:#000099--][span style=\"color:#000099\"][!--/coloro--]For example, a column specified as ENUM('one', 'two', 'three') can have any of the values shown here. The index of each value is also shown:

Value / Index
NULL / NULL
'' / 0
'one' / 1
'two' / 2
'three' / 3[!--colorc--][/span][!--/colorc--][!--fontc--][/span][!--/fontc--]

Thanks for the input though, Ober. Any other ideas?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users