Re: Date type: DATE

From: Frank Bax <fbax(at)sympatico(dot)ca>
To: Jesus Rios <galiza-vermelha(at)wanadoo(dot)es>, "POSTGRESLQ-PHP" <pgsql-php(at)postgresql(dot)org>
Subject: Re: Date type: DATE
Date: 2003-01-24 12:15:33
Message-ID: 5.1.1.6.0.20030124071129.009ff880@pop6.sympatico.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

At 01:59 PM 1/22/03, Jesus Rios wrote:
>I've got a form where I ask for the date.I store the date in 3 variables: for
>the day i have $day (dd), for the month i have $month (mm) and for the year
>$year (yyyy).
>At the same time i have a table which is as it follows:
> Table "s_objetivos_caso"
> Column | Type | Modifiers
> -----------------+---------+-----------
> dni | integer | not null
> fecha | date | not null
> cod_s_objetivos | integer | not null
>
>How do i have to insert the column date?.
>
> $date="$year-$month-$day";
> insert into s_objetivos_caso values ($dni,$date,$cod_s_objetivos,$conn);
>
>Can anyboy help me for how a i must format the date for introduce into the
>table???

Perhaps you could tell us what goes wrong with the above coding.
Others have mentioned issues with $date variable.
Does the code look "exactly" as above?
Surely you are coding the insert using pg functions?
pg_exec ($conn, "insert into s_objetivos_caso values
($dni,'$date',$cod_s_objetivos)";

Frank

In response to

Browse pgsql-php by date

  From Date Subject
Next Message Keary Suska 2003-01-24 17:03:24 Re: Date type: DATE
Previous Message sector119 2003-01-24 08:07:01 Re: connect to PostgreSQL over SSL from PHP