PROBLEMA CON EL TIPO DATE DE UNA COLUMNA DE UNA TABLA

Поиск
Список
Период
Сортировка
Искать

PROBLEMA CON EL TIPO DATE DE UNA COLUMNA DE UNA TABLA

От:
Jesus Rios <galiza-vermelha@wanadoo.es>
Дата:

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.

-------------------------------------------------------
FAQ