From: | "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk> |
---|---|
To: | "Andy Champion" <andychampion(at)hotmail(dot)com> |
Cc: | pgsql-interfaces(at)postgresql(dot)org |
Subject: | Re: libpq/INSERT |
Date: | 2001-04-24 16:14:33 |
Message-ID: | 200104241614.f3OGEXU02899@linda.lfix.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
"Andy Champion" wrote:
><html><DIV>
Please turn off html mode in your mailer.
>Hi, i'm trying to insert data pulled into a postgresql database but i'm
> having some problems with the inserts.
>
>i know that this:
> sprintf(insert_string, "INSERT INTO udpdata VALUES (1234);\n");
>
>is a valid statment, but how do i alter this so that instead of the 123
>4 i insert the value of a variable?
It sounds as though you need a basic course in C programming.
sprintf(insert_string, "INSERT INTO udpdata VALUES (%s);\n", string_variable);
sprintf(insert_string, "INSERT INTO udpdata VALUES (%d);\n", integer_variable);
You could find this out by reading the manual for sprintf...
--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"Now unto him that is able to do exceeding abundantly
above all that we ask or think, according to the power
that worketh in us, Unto him be glory in the church by
Christ Jesus throughout all ages, world without end.
Amen." Ephesians 3:20,21
From | Date | Subject | |
---|---|---|---|
Next Message | Brett W. McCoy | 2001-04-24 16:21:12 | Re: libpq/INSERT |
Previous Message | liam | 2001-04-24 16:13:36 | Re: libpq/INSERT |