Te recomiendo que hagas un echo al $query, y lo ejecutas en tu consola o pgadmin, si sale un error ahi te avisara.
El vie, 5 de mar. de 2021 a la(s) 13:10, Daniel Carrero (dcarre...@gmail.com) escribió: > Hola Flor, > Yo revisaría la sintaxis de la consulta, veo un */ de más y la > concatenación de strings es con . no con & > > Espero ayudar en algo > Saludos > > El vie, 5 de mar. de 2021 a la(s) 14:49, Flor Avila (fav...@gepesat.com) > escribió: > >> Agradecere si me brindan una respuesta a mi consulta. >> Gracias, >> Flor >> >> >> ---------- Forwarded message --------- >> De: Flor Avila <fav...@gepesat.com> >> Date: jue, 4 mar 2021 a las 11:59 >> Subject: INSERT PHP 7 >> To: <pgsql-es-ay...@postgresql.org>, <pgsql-es-ayuda@lists.postgresql.org >> > >> >> >> Buenos dias, >> Tengo una base de datos con postgres11 ahi hay una tabla historica que >> necesito hacer insert desde un programa php7, lo que sucede es que cuando >> hago insert no lo realiza y no se porque, les comento que antes se >> realizaba este insert desde un programa visual basic 6 en donde se tenia >> que usar dos string xq por lo grande del insert no soportaba y era asi: >> ws_execute = "" >> ws_execute = "INSERT INTO history.gpn_history (gps_id, history_lat, >> history_lon, history_date, history_altitude, history_angle, history_speed, >> history_command, >> history_quality, history_street, history_d01, history_d02, history_d03, >> history_d04, history_d05, history_d06, history_d07, history_d08, >> history_d09, history_d10, >> history_d11, history_d12, history_d13, history_d14, history_d15, >> history_d16, history_d17, history_d18, history_d19, history_d20, >> history_a01, history_a02, >> history_a03, history_a04, history_a05, history_a06, history_a07, >> history_a08, history_a09, history_a10, history_a11, history_a12, >> history_a13, history_a14, >> history_a15, history_a16, history_a17, history_a18, history_a19, >> history_a20) >> values ('" & ws_gps_id & "', " & ws_gpn_lat & ", " & ws_gpn_lon & ", '" & >> wd_gpn_date, 0, " & CStr(wi_gpn_angle) & ", " & CStr(wi_gpn_speed), 'BP05', >> " & CStr(wi_gpn_quality) '& ", " & ws_d01 >> ws_execute1 = "" >> ws_execute1 = ", '" & ws_gps_model & "', '" & ws_d01 & "', '" & ws_d02 >> & "', '" & ws_d03 & "', '" & ws_d04 & "', '" & ws_d05 & "', '" & ws_d06 & >> "', '" & ws_d06 & "', '" & ws_d08 & "', '" & ws_d09 & "', '" & ws_d10 & "', >> '" & ws_d11 & "', '" & ws_d12 & "', '" & ws_d13 & "', & ws_d14 & "', '" & >> ws_d15 & "', '" & ws_d16 & "', '" & ws_d17 & "', '" & ws_d18 & "', '" & >> ws_d19 & "', '" & ws_d20 & "', " & NULL, NULL, NULL, NULL, " & ws_a05 & ", >> NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, >> NULL, NULL, NULL)" >> >> Congpnb.Open "gpnext22", "postgres", "Gepesat2012" >> Set RShisb = Congpnb.Execute(ws_execute & ws_execute1) >> >> en php7 no se si tambien debo de usar dos string pero no se como se hace, >> el string que tengo en php 7 es: >> $query = "INSERT INTO history.gpn_history (gps_id, history_lat, >> history_lon, >> history_date, history_altitude, history_angle, history_speed, >> history_command, history_quality, history_street, >> history_d01, history_d02, history_d03, history_d04, history_d05, >> history_d06, history_d07, history_d08, history_d09, history_d10, >> history_d11, history_d12, history_d13, history_d14, history_d15, >> history_d16, history_d17, history_d18, history_d19, history_d20, >> history_a01, history_a02, history_a03, history_a04, history_a05, >> history_a06, history_a07, history_a08, history_a09, history_a10, >> history_a11, history_a12, history_a13, history_a14, history_a15, >> history_a16, history_a17, history_a18, history_a19, history_a20) >> values ('$xid', $ws_gpn_lat, $ws_gpn_lon, '$xdate', 0, $xangle, $xspeed, >> 'BP05', $xquality, '$xmodel', >> '$xd01', '$xd02', '$xd03', '$xd04', '$xd05', '$xd06', '$xd07', '$xd08', >> '$xd09', '$xd10', >> '$xd11', '$xd12', '$xd13', '$xd14', '$xd15', '$xd16', '$xd17', '$xd18', >> '$xd19', '$xd20', >> '$xa01', '$xa02', '$xa03', '$xa04', '$xa05', '$xa06', '$xa07', '$xa08', >> '$xa09', '$xa10', >> '$xa11', '$xa12', '$xa13', '$xa14', '$xa15', '$xa16', '$xa17', '$xa18', >> '$xa19', '$xa20');";*/ >> ws_execute1 = ws_execute1 & ", '" & ws_gps_model & "', '" & ws_d01 & >> "', '" & ws_d02 & "', '" & ws_d03 & "', '" & ws_d04 & "', '" & ws_d05 & "', >> '" & ws_d06 & "', '" & ws_d06 & "', '" & ws_d08 & "', '" & ws_d09 & "', '" >> & ws_d10 & "', '" & ws_d11 & "', '" & ws_d12 & "', '" & ws_d13 & "', '" >> ws_execute1 = ws_execute1 & ws_d14 & "', '" & ws_d15 & "', '" & ws_d16 >> & "', '" & ws_d17 & "', '" & ws_d18 & "', '" & ws_d19 & "', '" & ws_d20 & >> "', " >> ws_execute1 = ws_execute1 & " NULL, NULL, NULL, NULL, " & ws_a05 & ", >> NULL, NULL, NULL" >> ws_execute1 = ws_execute1 & ", NULL, NULL, NULL, NULL, NULL, NULL, >> NULL, NULL, NULL, NULL, NULL, NULL)" >> //// >> $result = pg_query($congpnext22, $query) or die('ERROR INSERT HISTORICO >> 22: ' . pg_last_error()); >> $cmdtuples = pg_affected_rows($result); >> echo $cmdtuples . " datos grabados 22."; >> >> Agradecere que me puedan ayudar. >> Saludos, >> Flor de Maria Avila Elias >> > > > -- > Daniel Carrero Canales > +56988895942 > -- Miguel Panuera, Jefe de Proyectos IUVADE SRL mpanu...@iuvade.com www.iuvade.com RPC 958335798