Posted by Mike on 10/12/88 11:38
I have a form where the user enters details including a date of
birth...
Day:
<input type=\"text\" name=\"day\" size=2 maxlength=2>
Month:
<input type=\"text\" name=\"month\" size=2 maxlength=2>
Year:
<input type=\"text\" name=\"year\" size=4 maxlength=4>
Then I do the following to convert it into the correct format..
$birthdate = $_POST['year']."-".$_POST['month']."-".$_POST['day'];
Then I insert it into the database...
$add = "insert into personal values ($birthdate)";
The field type in the database it set to 'Date'.
I run an echo on the code to check that $birthdate is storing the
correct data and it is...
1975-08-13
But when I check the database its stored the date as 0000-00-00. Why
is that??
Thanks
Mike
Navigation:
[Reply to this message]
|