Re: Date Function - Empty Value
| From: | Torsten Roehr | Date: | Wed, 19 May 2004 19:50:42 +0000 |
| Subject: | Re: Date Function - Empty Value | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-186556@lists.php.net to get a copy of this message | ||
"Gabe" <ydnahg-news4432@mailblocks.com> wrote in message
news:20040519193101.75891.qmail@pb1.pair.com...
> Torsten Roehr wrote:
>
> > "Gabe" <ydnahg-news4432@mailblocks.com> wrote in message
> > news:20040519152017.13913.qmail@pb1.pair.com...
> >
> >>Environment:
> >>PHP 4.3.6
> >>Access DB
> >>W2K IIS 5
> >>
> >>
> >>I'm trying to store a date in a date/time field using the short date
> >>format ( m/d/yyyy ). For some reason it won't let me post an empty
> >>value to that field in the DB. I've tried using empty quotes ( "" ) or
> >>NULL and I always get a datatype mismatch sql error. So then I just
> >>tried submitting a date that will never be used ( e.g. 1/1/1111 ). That
> >>works, but then when I try to read the date out of the field in the DB
> >>and format it using the date() function in PHP it doesn't display
> >>anything (which is fine with me). I read up on the date function on the
> >>PHP website and valid dates are limited from 01-01-1970 to 19-01-2038 on
> >>windows machines. So that explains why the function returns nothing.
> >>
> >>So, I guess my question is this: Is what I'm doing technically ok
> >>(using a date that's not in the valid range)? Or does anyone know of an
> >>empty date value that I can submit to the DB?
> >>
> >>Thanks!
> >
> >
> > NULL should work if you have allowed it for the column when creating the
> > table. Can you post your table structure?
> >
> > Regards, Torsten
>
> Well, I would, but I can't seem to figure out how to export just the
> structure out of access. Wouldn't NULL be allowed by default?
This command should show you the table structure:
SHOW CREATE TABLE tablename
Please post the output.
regards, Torsten