View Full Version : Field type problem
xiaodao
02-08-2006, 09:07 AM
i set field"start date" as DATE
but when i enter date formate like 2006-10-28
YYYY-MM-DD format
the data cannot be entereed
0000-00-00 is recorded
what happens
are you talking about MySQL? Wrong Forum?
maybe we can see some code? maybe the query? maybe a description of that table?
xiaodao
02-08-2006, 11:09 AM
HI,
my database
CREATE TABLE mw_test(
id INT(15) AUTO_INCREMENT NOT NULL,
todaydate DATE,
PRIMARY KEY(id)
)
Then i do one mysql insert
$sql=$db->query("INSERT INTO mw_test VALUES(NULL,'2006-10-22')");
then you check the phpmyadmin you will discover that the inserted todaydate is 0000-00-00
very strange
try changing your query to
sql=$db->query("INSERT INTO mw_test (todaydate) VALUES('2006-10-22')");
or run this inside the phpMyAdmin querywindow:
INSERT INTO mw_test (todaydate) VALUES('2006-10-22')
xiaodao
02-08-2006, 01:57 PM
can i enter value like DD-MM-YYYY
you can try, and MySQL will try to interpret it, but there is no guarantee that this interpretation will be correct. For instance, should 01-02-2005 be the first of februari or the second januari?
MySQL doesn't realy have a way of telling that, so it's not a good idea.
Did you try the suggestions i posted + what was the result?
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.