Reply to adding date to a database

Your name:

Reply:


Posted by Mike on 10/13/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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация