MYSQL timestamp problem

Discussion in 'MySQL' started by shubhamjain, Jan 4, 2010.

  1. #1
    I have a table with following attribues, ignore unalignment :p.
    Field  Type           	Null  	Default   
    url       varchar(15) 	No  	  	 
    email  	tinytext      	No  	  	 
    paste longtext             No  	  	 
    title    text           	No  	  	 
    private 	tinyint(1)     	No  	  	 
    date 	varchar(35) 	No  	  	 
    language 	varchar(25) 	No  	  	 
    timestamp 	timestamp    	No  	CURRENT_TIMESTAMP 
    Code (markup):
    Now i want automatically add CURRENT_TIMESTAMP in the timestamp field on every query but the timestamp is always, 0000-00-00 00:00:00.
     
    shubhamjain, Jan 4, 2010 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    Are you passing anything to the timestamp column when you make an insert, 0, '', or even NULL? You need to make sure you are not inserting anything into that column if you want to get CURRENT_TIMESTAMP. That's the only thing I can think of why you are getting 0000-00-00 00:00:00.
     
    jestep, Jan 5, 2010 IP