sql - how to insert multiple row in single query in PostgreSQL -


i have variable holds multiple data, , want insert multiple data postgresql database using single query.

the field on table this: stud_tbl(id,fname,lname)

and variable holds multiple data;

variable = (123,ron,lum),(234,nald,bay),(345,rol,lumz) 

my query:

str = "insert stud_tbl values ('" & variable & "')" 

when execute query error , can't identify error.

to expand on @patrick's comment:

variable = "(123,'ron','lum'),(234,'nald','bay'),(345,'rol','lumz')" 

the query:

str = "insert stud_tbl values " & variable  

though usual warnings (how can prevent sql injection in php?) not being best practice apply.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -