The Little Guy Posted January 17, 2009 Share Posted January 17, 2009 I have been having all kinds of trouble with this script, and here is the last thing I need YEY! I have one field that is "Supposed" to update the date when the row is updated, why doesn't it work? its a "timestamp" its attribute is: "ON UPDATE CURRENT_TIMESTAMP" default value: "0000-00-00 00:00:00" Quote Link to comment Share on other sites More sharing options...
corbin Posted January 17, 2009 Share Posted January 17, 2009 Does it update the date to something wrong, or does it do nothing? Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted January 17, 2009 Author Share Posted January 17, 2009 it doesn't update at all Quote Link to comment Share on other sites More sharing options...
corbin Posted January 17, 2009 Share Posted January 17, 2009 What's your table schema look like? Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted January 17, 2009 Author Share Posted January 17, 2009 CREATE TABLE IF NOT EXISTS `projects` ( `id` bigint(20) NOT NULL auto_increment, `owner_id` bigint(20) NOT NULL, `url` varchar(255) NOT NULL, `title` varchar(100) NOT NULL, `comment` varchar(2000) NOT NULL, `counter` bigint(20) NOT NULL, `date` varchar(20) NOT NULL, `projectCode` varchar(10) NOT NULL, `public` enum('yes','no') NOT NULL default 'yes', `visitors` bigint(20) default NULL, `views` bigint(20) default NULL, `updated` timestamp NOT NULL default '0000-00-00 00:00:00' on update CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ; Quote Link to comment Share on other sites More sharing options...
corbin Posted January 17, 2009 Share Posted January 17, 2009 That's strange.... I just tested with your exact schema, and it worked fine. What MySQL version are you using, and what is your update query? Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted January 17, 2009 Author Share Posted January 17, 2009 UPDATE projects SET visitors = '%s', views = '%s' WHERE id = '%s' Quote Link to comment Share on other sites More sharing options...
fenway Posted January 18, 2009 Share Posted January 18, 2009 Version, please. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.