PROBLEMA CON EL TIPO DATE DE UNA COLUMNA DE UNA TABLA

PROBLEMA CON EL TIPO DATE DE UNA COLUMNA DE UNA TABLA

am 28.01.2003 13:04:10 von Jesus Rios

Hi. I have written onces for the same question, with no sucess for me.
I have a table so:

Table "s_objetivos_caso"
Column | Type | Modifiers
- ----------------+---------+-----------
dni | integer | not null
fecha | date | not null
cod_s_objetivos | integer | not null


I have 3 variables in my form where i get the date:
$fecha_anho,$fecha_mes,$fecha_dia.
when i want to insert into the table io do so:



include ("globals.php");
$conn=conectarbd($user,$password,$dbname);
$tdate=$fecha_anho."-".$fecha_mes."-".$fecha_dia;-------> HERE IS THE PROBLEM

$tabla="s_objetivos_caso";
$dni=232;
$cod_s_objetivos=1;

$aux_s_obj=inserta_tabla_generica_caso($dni,$tdate,$cod_s_ob jetivos,$conn,$ta
bla); if(!$aux_s_obj)
{
echo ("Error al rellenar la tabla=s_objetivos_caso");
}


?>
The function is :


function inserta_tabla_generica_caso($denei,$data,$cod,$cone,$table)
{
$insert="INSERT INTO $table VALUES('$denei','$data','$cod')"; ********
$result=pg_exec($cone,$insert);
if ($result)
{
return true;
}
else
{
return false;
}
}


The error which throw me the navigator is:


Warning: PostgreSQL query failed: ERROR: Bad date external representation
'--' in /var/www/jesus/foniatra/globals.php on line 55
Error al rellenar la tabla=s_objetivos_caso

line 55 is which who has **********

In which format i must put the date for insert it into the table?

If it is a help , when i do:
foniatra=# SELECT now()::date; ------>
------------
2003-01-28
(1 row)



In my form i have this:


FECHA DE LA CONSULTA







(yyyy)


Thank you.

-------------------------------------------------------

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html