homepage Welcome to WebmasterWorld Guest from 54.166.228.100
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Can't insert dates
Dates are being entered as 0000-00-00
dougmcc1




msg:3006229
 10:43 pm on Jul 13, 2006 (gmt 0)

I'm trying to import some data into my database. The table I'm trying to import the data into has a date column in the first field. Even when I click the 'Insert' button in phpmyadmin, type in '2006-04-31' in the date field, and press 'Go' to insert the enw row the date is still entered as 0000-00-00.

I have about 3000 rows of data and even doing an update query after the import doesnt work. For example, "update table set date='2006-04-31' WHERE date='0000-00-00'" affects 0 rows even though the date for all of them is 0000-00-00 and I can delete them using this query "delete FROM `google_data` WHERE date='0000-00-00'".

Any idea whats going on? The field type is 'date', null is set to 'no', and Default is set to '0000-00-00'.

 

RonPK




msg:3006248
 10:52 pm on Jul 13, 2006 (gmt 0)

April has only 30 days. How does your database handle invalid dates?

PhraSEOlogy




msg:3006254
 10:58 pm on Jul 13, 2006 (gmt 0)

Invalid dates are stored as 0000-00-00 in mysql.

dougmcc1




msg:3007357
 2:45 pm on Jul 14, 2006 (gmt 0)

Wow, of all the technical work-arounds I tried for over an hour to do a simple import that worked fine on other files it never even occurred to me the date was wrong lol.

Lesson learned. Thanks so much!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved