PHP Classes

NULL not handled

Recommend this page to a friend!

      My Active Record  >  All threads  >  NULL not handled  >  (Un) Subscribe thread alerts  
Subject:NULL not handled
Summary:NULL fields are being entered into table as empty strings
Messages:1
Author:Red Reid
Date:2007-05-28 14:49:14
 

  1. NULL not handled   Reply   Report abuse  
Picture of Red Reid Red Reid - 2007-05-28 14:49:14
Here is the table:
CREATE TABLE `rsvp` (
`id` smallint(3) NOT NULL auto_increment,
`name` varchar(255) NOT NULL default '',
`guests_id` smallint(3) default '0',
`attending` enum('yes','no') NOT NULL default 'yes',
`email` varchar(255) default NULL,
`accommodation` varchar(255) default NULL,
`accommodation_id` smallint(2) default '0',
`note` text,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

When I write this code:
class rsvp extends MyActiveRecord {
}
$rsvp = new rsvp();
$rsvp->name = 'Spooner';
$rsvp->save();

The fields email and sccommodation have empty strings instead of NULL s

Am I doing something wrong?