Last updated 19 February 2008. Created on 14 July 2007.
Edited by ax, webchick, bjaspan. Log in to edit this page.

A field's default value, if it has one, must be of a type that is compatible with the field's database type. Database engines typically have type-conversion rules so that, for example, if your provide the string '0' for an integer column it is converted into the integer 0, but it is still better to specify the correct data type in the schema definition.

The following table defines the correct types and shows correct and incorrect examples.

Field type PHP types Correct Incorrect
int integer 0, 3, 17 0.5, '0'
float float 7, 5.75 '1.24'
numeric float 3.14 '2.17'
datetime string '2007-08-26 13:00:00' Unix timestamp
varchar string '', 'hi mom' 0, 3.14
text N/A none
serial N/A none
blob N/A none

Looking for support? Visit the forums, or join #drupal-support in IRC.