im not sure but i dont think you can store functions inside of a sql database and have it run the function, however sql has a built in way to put timestamps in, try this:
Code:
CREATE TABLE IF NOT EXISTS `test` (
`id` int(11) NOT NULL auto_increment,
`modified` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`created` timestamp NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
you will need to add a way to put the timestamp for the created, such as the php function date()
also, you can only have one field time be timestamped otherwise you will get this error
Code:
Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause