Re: Insert Data Into Mysql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In your validation routine, check to see whether the date coming from the user is blank or not (if it's not blank, make sure it's valid).

If it's valid, assign it to a variable in the format 'yyyy-mm-dd'. If it's blank put '1901-01-01' in the variable.

When you do you MySQL statement use that variable. You should be storing dates in the database as yyyy-mm-dd format, not mm/dd/yyyy.

Ken

At 04:53 PM 1/10/2014, Robert wrote:

I have a date field on an html form that users may leave blank. If they do leave it blank I want to write the date 01/01/1901 into the mysql table. How can I accomplish this and where in my .php script file should I put the code?

Thank You,
Robert
flahurr@xxxxxxxxxxx

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux