From: Jesus Rios <galiza-vermelha@wanadoo.es>
To: POSTGRESLQ-PHP <pgsql-php@postgresql.org>
Subject: PROBLEMA CON EL TIPO DATE DE UNA COLUMNA DE UNA TABLA
Date: Tue, 28 Jan 2003 13:04:10 +0100
Message-ID: <200301281202.h0SC2VJ08035@smtp.wanadoo.es> (raw)
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:
<?php
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_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:
<tr>
<td width="100%" align="center"> <b>FECHA DE LA CONSULTA
</b> </td>
<td height="2">
<select name=fecha_dia >
<option selected value=1>01
<option value=2>02
<option value=3>03
<option value=4>04
<option value=5>05
<option value=6>06
<option value=7>07
<option value=8>08
<option value=9>09
<option value=10>10
<option value=11>11
<option value=12>12
<option value=13>13
<option value=14>14
<option value=15>15
<option value=16>16
<option value=17>17
<option value=18>18
<option value=19>19
<option value=20>20
<option value=21>21
<option value=22>22
<option value=23>23
<option value=24>24
<option value=25>25
<option value=26>26
<option value=27>27
<option value=28>28
<option value=29>29
<option value=30>30
<option value=31>31 </option>
</select>
<select name=fecha_mes>
<option selected value=1>enero
<option value=2>febrero
<option value=3>marzo
<option value=4>abril
<option value=5>mayo
<option value=6>junio
<option value=7>julio
<option value=8>agosto
<option value=9>septiembre
<option value=10>octubre
<option value=11>noviembre
<option value=12>diciembre </option>
</select>
<input maxlength=4 name=fecha_anho size=4>
(yyyy) </td>
</tr>
Thank you.
-------------------------------------------------------
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: galiza-vermelha@wanadoo.es
Subject: Re: PROBLEMA CON EL TIPO DATE DE UNA COLUMNA DE UNA TABLA
In-Reply-To: <200301281202.h0SC2VJ08035@smtp.wanadoo.es>
References: <200301281202.h0SC2VJ08035@smtp.wanadoo.es>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox