Ver Mensaje Individual
  #5 (permalink)  
Antiguo 21/11/2007, 14:05
Avatar de spike01
spike01
 
Fecha de Ingreso: octubre-2007
Mensajes: 18
Antigüedad: 16 años, 6 meses
Puntos: 0
Re: Problemas con insert php + postgres

hola nuevamente,

mira borre la tabla y la volvi a crear y perfecto ya no me salen las comillas, ahora me sale este error


Warning: pg_exec(): Query failed: ERROR: invalid input syntax for integer: "" in c:\appserv\www\hc\html\doctor1.php on line 23

el script:

<?php
if ($opcion =="Enviar")
{
$insertSQL = "INSERT INTO doctor(docno_d, ape1_d, ape2_d, nom_d, rprof_d, dir_d, tel_d, mov_d, email_d, consultorio_d, id_esp_mg) ";
$insertSQL .= "VALUES ( '" .$docNo_d. "', '" .$ape1_d. "' , '" .$ape2_d. "' , '" .$nom_d. "', '" .$rprof_d. "', '" .$dir_d. "', '" .$tel_d. "', '" .$mov_d. "', '" .$email_d. "', '" .$consultorio_d. "', '" .$id_esp_mg. "' ) ";

$Result1 = pg_exec($HC,$insertSQL) or die(pg_result_error());
$_SESSION['cedula']= $docNo_d;
echo "<script language=javascript>alert('Datos insertados con Exito!!');</script>";
?>
<SCRIPT LANGUAGE="javascript">location.href = "guardar_med.php";</SCRIPT>
<?php
}
?>

asi kedo la tabla:

CREATE TABLE doctor
(
docno_d bigserial NOT NULL,
ape1_d character varying,
ape2_d character varying,
nom_d character varying,
rprof_d bigserial NOT NULL,
dir_d character varying,
tel_d bigserial NOT NULL,
mov_d bigserial NOT NULL,
email_d character varying,
consultorio_d bigint,
foto bytea,
id_esp_mg serial NOT NULL,
CONSTRAINT doctor_pkey PRIMARY KEY (docno_d),
CONSTRAINT doctor_id_esp_mg_fkey FOREIGN KEY (id_esp_mg)
REFERENCES especialidad_mg (id_esp_mg) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITHOUT OIDS;
ALTER TABLE doctor OWNER TO postgres;

le agradesco nuevamente su colaboracion