explicitly setting timestamps in DataObject

From: Date: Wed, 23 Feb 2005 23:35:18 +0000
Subject: explicitly setting timestamps in DataObject
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-17658@lists.php.net to get a copy of this message
Hey, I had good success with this board last time, so I thought I'd try again. This time I spent a lot more time reading through documentation and code before posting. I have a table with 2 timestamp fields, modified_on and created_on. Following the documentation for the version of mysql I'm using, modified_on should be updated every time the row is updated, and created_on should be left alone unless explicitly set. My idea was to set created_on explicity in the overloaded insert() method for the DataObject class. So I put the statement: $this->created_on = date('Ymdhis'); in the insert statement before called parent::insert(). And it totally didn't work. At first I thought I had screwed up the format of the timestamp. But when I set debug to 5, I saw this: INSERT INTO comment (comment_comment_type , comment_comment_status , comment_user_id , comment_item_id , comment_title , comment_body ) VALUES ( 3 , 1 , 2548 , 21 , 'analogically umm twitched kneeled walking after iguana' , 'Hello, that pill bug is much more archaic than some flirtatious woodchuck. Jeez, the effective krill ' ) The insert statement is not including created_by. But when I output the member var before and after the insert, it shows as being there. Any clues?

« previous php.pear.general (#17658) next »