Received: from anchor-post-31.mail.demon.net (anchor-post-31.mail.demon.net [194.217.242.89]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f3OGEe379102 for ; Tue, 24 Apr 2001 12:14:40 -0400 (EDT) (envelope-from olly@lfix.co.uk) Received: from lfix.demon.co.uk ([158.152.59.127] helo=linda.lfix.co.uk) by anchor-post-31.mail.demon.net with esmtp (Exim 2.12 #1) id 14s5SY-000BBP-0V; Tue, 24 Apr 2001 17:14:38 +0100 Received: from lfix.co.uk (olly@localhost [127.0.0.1]) by localhost (8.11.3/8.11.3/Debian 8.11.2-1) with ESMTP id f3OGEXU02899; Tue, 24 Apr 2001 17:14:34 +0100 Message-Id: <200104241614.f3OGEXU02899@linda.lfix.co.uk> X-Mailer: exmh version 2.3.1 01/18/2001 (debian 2.3.1-1) with nmh-1.0.4+dev X-URL: http://www.lfix.co.uk/oliver X-face: "xUFVDj+ZJtL_IbURmI}!~xAyPC"Mrk=MkAm&tPQnNq(FWxv49R}\>0oI8VM?O2VY+N7@F- KMLl*!h}B)u@TW|B}6 cc: pgsql-interfaces@postgresql.org Subject: Re: libpq/INSERT In-reply-to: Message from "Andy Champion" of Tue, 24 Apr 2001 15:31:55 -0000. Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 24 Apr 2001 17:14:33 +0100 From: "Oliver Elphick" X-Archive-Number: 200104/107 X-Sequence-Number: 1491 "Andy Champion" wrote: >
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.Elphick@lfix.co.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