#include<stdio.h><br>#include "/usr/include/libpq-fe.h"<br><br>void main()<br>{<br><br>PGconn *conn;<br>PGresult *res;<br>int id;<br>char name[20];<br>char *qur;<br><br>conn = PQsetdbLogin("127.0.0.1","5432",NULL,NULL,"postgres","postgres",NULL);<br>
<br><br> if(PQstatus(conn)==CONNECTION_OK)<br> {<br> printf("Connection Established\n\n");<br> <br> <br> printf("Enter the ID: \n");<br> scanf("%d",&id);<br> printf("Enter the NAME: \n");<br>
scanf("%s",&name);<br> *qur="insert into table values(id,name)"; <--------Error here, Why?<br> res = PQexec(conn,qur);<br><br> PQfinish(conn);<br> }<br> else<br> {<br> printf("Connection Failed\n");<br>
}<br><br><br>}<br>