Re: Inserting Dates into a postgresql database
| From: | Jason Wong | Date: | Tue, 29 Apr 2003 09:25:29 +0000 |
| Subject: | Re: Inserting Dates into a postgresql database | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-145606@lists.php.net to get a copy of this message | ||
On Tuesday 29 April 2003 17:05, Matt MacLeod wrote:
> Hi,
>
> I'm having trouble formatting a date to be inserted into a postgresql
> date field.
>
> Basically I have a feedback form and I want to log the date
> (day/month/year) in the database as well as the feedback form fields.
>
> This is my current effort:
>
> -------->
> $today = getdate();
> $year = $today['year'];
> $month = $today['month'];
> $day = $today['mday'];
> $datetoday = $year-$month-$day;
print($datetoday) and tell us what you get.
> ------->
> Warning: pg_query() [function.pg-query]: Query failed: ERROR: Bad date
> external representation '1974' . in
> /usr/local/etc/apache_1.3.27/htdocs/feedback/feedback2.php on line 16
> Error:
> ERROR: Bad date external representation '1974'
> <------
> I'm pretty new to both PHP and postgres so any help provided would be
> gratefully received.
ALWAYS print out your variables to see that they contain what you expect to
contain. print_r() and var_dump() are your best debugging tools.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Oh, so there you are!
*/