pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris Smith <csmith@squiz.net>
To: Chadwick Rolfs <c2304182@webdevel.urban.csuohio.edu>
To: pgsql-php@postgresql.org
Subject: Re: Test (fwd)
Date: Thu, 14 Jun 2001 10:22:43 +1000
Message-ID: <4.3.2.7.2.20010614101703.02215160@cooee.cybersydney.com.au> (raw)
In-Reply-To: <Pine.LNX.4.33.0106131937010.13453-100000@webdevel.urban.cs uohio.edu>

Write your own function.

function compileinsertquery($table,$formfieldarray,$formfieldvalues) {
         $insertquery = "INSERT INTO $table (";
         foreach ($formfieldarray as $id => $val) {
                 $insertquery .= $val.",";
         }
         $insertquery = substr($insertquery,0,-1); # remove last ,
         $insertquery .= ") VALUES (";
         foreach ($formfieldvalues as $id => $val) {
                 $insertquery .= "'".$val."',";
         }
         $insertquery = substr($insertquery,0,-1); # remove last ,
         $insertquery .= ")";
echo "your insert query is ".$insertquery;
}

obviously check it's working ok (this is a 10sec job) before using it.

all done.

And yes, the pg_exec function is the only way to actually manipulate the 
database in any way. If you've read the docs, you'd know this.

>To reword.
>
>I am an open source programmer just learning the ropes.  I am about
>halfway through the php documentation at zend.com, and can't seem to post
>to the php.lists.net.  So I am asking someone here...
>I need to take the entries from several web forms, and put their contents
>into a postresql database.  The php function pg_exec is the only way I've
>seen to actually use INSERT.
>Here is my idea:  -using arrays
>
>$query = "insert into <table_name> ($names_of_form_fields)
>                                                 values 
> ($values_of_form_fields);
>
>so there you have it.
>I have been to php.net
>I read documentation religiously
>i'm simply asking for help
>anyone?
>
>
>---------- Forwarded message ----------
>Date: Wed, 13 Jun 2001 15:11:08 -0400 (EDT)
>From: Chadwick Rolfs <c2304182@webdevel.urban.csuohio.edu>
>To: pgsql-php@postgresql.org
>Subject: Test
>
>I can't seem to post to this list that I keep recieving e-mail from.  I
>want to parse a web form through php and put it into a postgresql
>batabase.  Who can help?  or point me toward the right direction...
>thanks.

----------------------
      Chris Smith
http://www.squiz.net/ 




view thread (3+ messages)  latest in thread

Message-ID: <4.3.2.7.2.20010614101703.02215160@cooee.cybersydney.com.au>
Permalink:  ../4.3.2.7.2.20010614101703.02215160@cooee.cybersydney.com.au/
Also on:    postgresql.org/message-id/4.3.2.7.2.20010614101703.02215160@cooee.cybersydney.com.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: csmith@squiz.net, c2304182@webdevel.urban.csuohio.edu
  Subject: Re: Test (fwd)
  In-Reply-To: <4.3.2.7.2.20010614101703.02215160@cooee.cybersydney.com.au>
  References: <4.3.2.7.2.20010614101703.02215160@cooee.cybersydney.com.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox