我从页面获取方法发布数据,并像这样插入表中
$b = $_POST['birth'];
//when i write echo $b; it prints 2013-10-13, i normally get data from page
$query = "INSERT INTO MEMBERS VALUES" .
"('$firstname', '$lastname', $b, '$login', '$password')";
if (!mysql_query($query, $db_server))
echo "INSERT failed: $query<br />" . mysql_error() . "<br /><br />";
我的桌子是
f_name VARCHAR(32) NOT NULL,
l_name VARCHAR(32) NOT NULL,
birthday DATE NOT NULL,
login_id VARCHAR(32) NOT NULL,
password VARCHAR(32) NOT NULL,
PRIMARY KEY (login_id)
但是它将时间设置为0000-00-00,不知道为什么。