Welcome Guest, Not a member yet? Register   Sign In
Active records problem
#3

[eluser]mddd[/eluser]
Inserting an empty string into a database field is different from inserting NOTHING into that field.
If you insert nothing, or you don't even specify the field at all in your INSERT query, then you will get the default value.
If you DO insert something (namely an empty string) then THAT will be inserted. (And if the field is not a text/char field, the empty string will be translated to something that does match the type, like 0).

Consider this: if you inserted an empty string into a text field and that text field had a default value, what should mysql do? Well, save the empty string of course! That is what you put in there. It won't put in a default value if you specify a value. Even if your value is an empty string, or 0.


Messages In This Thread
Active records problem - by El Forum - 04-14-2010, 01:28 AM
Active records problem - by El Forum - 04-14-2010, 02:54 AM
Active records problem - by El Forum - 04-14-2010, 03:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB