Skip to content
Advertisement

Insert into DB with PHP and Postgresql

i don’t understand why i can’t insert into DB. I have create a DB with this table:

prenotazione (id,nome_rich,cognome_rich,email_rich,oggetto_rich)

interni (id,nome_int,cognome_int,email_int)

esterni (id,nome_est,cognome_est,email_est)

this is my index.php

JavaScript

And this is the input.php that i used to insert the data ( and also to connect to DB )

JavaScript

utils.js

JavaScript

I have test the connection to DB and i Receive the positive message ( in the echo ). But if i controll the tables they are empty.

Advertisement

Answer

Try the below code

JavaScript

This code is trying to insert into thte database as a batch. Try to echo the query string, to see the sql query created and run it on PG to see if there is any issues with the query.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement