CodeIgniter Forums

Full Version: database Truncate error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]reghan[/eluser]
Hello I am having issues with my database/codeigniter program


there error I am getting is:

Error Number: 1265

Data truncated for column 'Day2_LostRevenue' at row 1

its when I try and submit a blank into the database.

its set up as follows:

type: float(9,2)
null: yes
default: null

is this happening because its trying to insert null into a column thats a float?

I am just not sure what to do. I would like to be able to insert nothing an have it blank if that makes sense.

Thanks in advance

El Forum

[eluser]InsiteFX[/eluser]
Set a default like 0.00

El Forum

[eluser]reghan[/eluser]
I have set a default:

Day1_LostRevenue float(9,2) Yes 0.00

it still gives me that error, I I cannot insert a blank.


Any other suggestions?

Thankyou!

El Forum

[eluser]InsiteFX[/eluser]
If you do not set it to anything the default will set it to 0.00
If you are dealing with money there should always be a default like 0.00

Change your default from null to 0.00

El Forum

[eluser]reghan[/eluser]
Thanks for the reply.

I have set the money column to

null = no
default = as defined: 0.00

and it still gives me the truncate error:

Error Number: 1265

Data truncated for column 'Day1_LostRevenue' at row 1
for the column that I have set the default to 0.00.

SO I am really unsure what the problem says. I totally agree with your answers, but its just not working.

El Forum

[eluser]reghan[/eluser]
ALTER TABLE `process` CHANGE `Day1_LostRevenue` `Day1_LostRevenue` FLOAT( 9, 2 ) NOT NULL DEFAULT '0.00'

this statement was sucessfull.

El Forum

[eluser]Aken[/eluser]
What is a "blank" that you're trying to insert?

El Forum

[eluser]InsiteFX[/eluser]
This is what I found for this error 1265