pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedTest (fwd)
3+ messages / 3 participants
[nested] [flat]
* Test (fwd)
@ 2001-06-13 23:44 Chadwick Rolfs <c2304182@webdevel.urban.csuohio.edu>
0 siblings, 1 reply; 3+ messages in thread
From: Chadwick Rolfs @ 2001-06-13 23:44 UTC (permalink / raw)
To: pgsql-php
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.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Test (fwd)
@ 2001-06-14 00:22 Chris Smith <csmith@squiz.net>
0 siblings, 0 replies; 3+ messages in thread
From: Chris Smith @ 2001-06-14 00:22 UTC (permalink / raw)
To: Chadwick Rolfs <c2304182@webdevel.urban.csuohio.edu>; pgsql-php
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/
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Test (fwd)
@ 2001-06-14 14:04 Adam Lang <aalang@rutgersinsurance.com>
parent: Chadwick Rolfs <c2304182@webdevel.urban.csuohio.edu>
0 siblings, 0 replies; 3+ messages in thread
From: Adam Lang @ 2001-06-14 14:04 UTC (permalink / raw)
To: pgsql-php
Your insert idea won't work. SQL knows nothing (in regards to PHP) of
arrays. You actually have to break out the variables.
$query = "insert into <table_name> (field1, field2, field3) values ($text1,
$text2, text3);"
Plus, you have to make sure to check for apostrophes. That will break your
SQL statement if someone typed them into the text field.
Adam Lang
Systems Engineer
Rutgers Casualty Insurance Company
http://www.rutgersinsurance.com
----- Original Message -----
From: "Chadwick Rolfs" <c2304182@webdevel.urban.csuohio.edu>
To: <pgsql-php@postgresql.org>
Sent: Wednesday, June 13, 2001 7:44 PM
Subject: [PHP] Test (fwd)
> 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.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2001-06-14 14:04 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-06-13 23:44 Test (fwd) Chadwick Rolfs <c2304182@webdevel.urban.csuohio.edu>
2001-06-14 14:04 ` Adam Lang <aalang@rutgersinsurance.com>
2001-06-14 00:22 Re: Test (fwd) Chris Smith <csmith@squiz.net>
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