Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1ADA5476E3B for ; Tue, 28 Jan 2003 07:03:16 -0500 (EST) Received: from smtp.wanadoo.es (unknown [62.37.236.136]) by postgresql.org (Postfix) with ESMTP id 3010C476939 for ; Tue, 28 Jan 2003 07:03:14 -0500 (EST) Received: from there (62-36-72-74.dialup.uni2.es [62.36.72.74]) by smtp.wanadoo.es (8.11.3/8.10.2) with SMTP id h0SC3ET03973 for ; Tue, 28 Jan 2003 13:03:15 +0100 (MET) Message-Id: <200301281203.h0SC3ET03973@smtp.wanadoo.es> Content-Type: text/plain; charset="iso-8859-1" X-KMail-Redirect-From: Jesus Rios Subject: Problem with the type date From: Jesus Rios (by way of Jesus Rios ) Date: Tue, 28 Jan 2003 13:04:52 +0100 To: "POSTGRESLQ-PHP" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/80 X-Sequence-Number: 1825 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: 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_objetivos,$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. -------------------------------------------------------