Off topic:How to insert data in Postgresql using PHP
0
0
Entering edit mode
6.0 years ago
nemo ▴ 40

I would like to add rows to my table in PostGresql. I wrote the following code:

$M = array("H","HS","P");
$dbconn = pg_Connect(pg_Connect("localhost", "5432", "", "", "test");
foreach ($M as $Match){
       $query = "INSERT INTO table_name ("ID","SP","Match") VALUES ("A","Human",$Match);
       $query = pg_query($query);
}
pg_Close($dbconn);

I got as error "query fails". Could someone tell me what I am doing wrong?

php PostGreSQL html query postgresql • 4.6k views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 2950 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6