From kestutis98@yahoo.com Mon May 20 11:20:11 2002 Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id D08AB475873 for ; Mon, 20 May 2002 07:20:11 -0400 (EDT) Received: from web13908.mail.yahoo.com (web13908.mail.yahoo.com [216.136.175.71]) by postgresql.org (Postfix) with SMTP id 87BAA475862 for ; Mon, 20 May 2002 07:20:10 -0400 (EDT) Message-ID: <20020520112013.84121.qmail@web13908.mail.yahoo.com> Received: from [195.14.169.50] by web13908.mail.yahoo.com via HTTP; Mon, 20 May 2002 04:20:13 PDT Date: Mon, 20 May 2002 04:20:13 -0700 (PDT) From: ktt Subject: unable to insert rows with php To: pgsql-php@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Archive-Number: 200205/73 X-Sequence-Number: 1205 Hello, I'm trying to insert data in the table, using PHP interface, but script creates an empty row without data. If you had similar problem, please, suggest a solution. I'm using Debian potato, PostgreSQL 7.2, Apache 1.3.24. Thank you in advance, ktt __________________________________________________ Do You Yahoo!? LAUNCH - Your Yahoo! Music Experience http://launch.yahoo.com From kestutis98@yahoo.com Mon May 20 12:04:17 2002 Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 4D606475BED for ; Mon, 20 May 2002 08:04:17 -0400 (EDT) Received: from web13902.mail.yahoo.com (web13902.mail.yahoo.com [216.136.175.28]) by postgresql.org (Postfix) with SMTP id 77B9B475A55 for ; Mon, 20 May 2002 08:04:15 -0400 (EDT) Message-ID: <20020520120418.51354.qmail@web13902.mail.yahoo.com> Received: from [195.14.169.50] by web13902.mail.yahoo.com via HTTP; Mon, 20 May 2002 05:04:18 PDT Date: Mon, 20 May 2002 05:04:18 -0700 (PDT) From: ktt Subject: Re: unable to insert rows with php To: angelo.rigo@globo.com Cc: pgsql-php@postgresql.org In-Reply-To: <3CD293640005CFA4@nplex.globo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Archive-Number: 200205/75 X-Sequence-Number: 1207 --- angelo.rigo@globo.com wrote: > Can you show your code ? yes. it's written for test. ------ \n", $row[0]); printf ("First Name: %s
\n", $row[1]); printf ("Surname : %s
\n", $row[2]); $query3 = "INSERT INTO friends (id, firstname, surname) values (nextval('friends_id_seq'), '$firstname', '$surname')"; $result = pg_exec($db, $query3); if (!$result) { printf ("ERROR"); $errormessage = pg_errormessage($db); echo $errormessage; exit; } pg_close(); printf ("These values were inserted into the database - %s %s", $firstname, $surname); echo"
"; echo "First Name : "; echo "
Surname : "; echo "
"; echo "
"; ?> > -- Mensagem Original -- > > > > >Hello, > > > >I'm trying to insert data in the table, using PHP > >interface, but script creates an empty > >row without data. > >If you had similar problem, please, suggest > >a solution. > >I'm using Debian potato, PostgreSQL 7.2, > >Apache 1.3.24. > > > >Thank you in advance, > > > >ktt > > > > > > > > > >__________________________________________________ > >Do You Yahoo!? > >LAUNCH - Your Yahoo! Music Experience > >http://launch.yahoo.com > > > >---------------------------(end of > broadcast)--------------------------- > >TIP 2: you can get off all lists at once with the > unregister command > > (send "unregister YourEmailAddressHere" to > majordomo@postgresql.org) > > > > > > > ________________________________________ > A busca mais veloz e precisa da internet. Acesse > agora: http://www.zoom.com.br. > __________________________________________________ Do You Yahoo!? LAUNCH - Your Yahoo! Music Experience http://launch.yahoo.com From duncan.adams@vcontractor.co.za Mon May 20 13:19:01 2002 Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id C94A9475D3C for ; Mon, 20 May 2002 09:19:01 -0400 (EDT) Received: from vodabemail2.vodacom.co.za (vodabemail2.vodacom.co.za [196.6.129.90]) by postgresql.org (Postfix) with ESMTP id 4FA9A475D39 for ; Mon, 20 May 2002 09:18:58 -0400 (EDT) Received: by vodabemail2.vodacom.co.za with Internet Mail Service (5.5.2653.19) id ; Mon, 20 May 2002 15:14:43 +0200 Message-ID: <7DD34E6DF5CD1B4283DDAB96A855DCED2F334F@vodabemail1.vodacom.co.za> From: "Duncan Adams (DNS)" To: pgsql-php@postgresql.org Subject: Re: unable to insert rows with php Date: Mon, 20 May 2002 15:18:49 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" X-Archive-Number: 200205/77 X-Sequence-Number: 1209 $query3 = "INSERT INTO friends (id, firstname, surname) values (nextval('friends_id_seq'), '$firstname', '$surname')"; where do u get the values for $firstname and $surname should that not be $row[1] and row[2] -----Original Message----- From: ktt [mailto:kestutis98@yahoo.com] Sent: Monday, May 20, 2002 2:04 PM To: angelo.rigo@globo.com Cc: pgsql-php@postgresql.org Subject: Re: [PHP] unable to insert rows with php --- angelo.rigo@globo.com wrote: > Can you show your code ? yes. it's written for test. ------ \n", $row[0]); printf ("First Name: %s
\n", $row[1]); printf ("Surname : %s
\n", $row[2]); $query3 = "INSERT INTO friends (id, firstname, surname) values (nextval('friends_id_seq'), '$firstname', '$surname')"; $result = pg_exec($db, $query3); if (!$result) { printf ("ERROR"); $errormessage = pg_errormessage($db); echo $errormessage; exit; } pg_close(); printf ("These values were inserted into the database - %s %s", $firstname, $surname); echo"
"; echo "First Name : "; echo "
Surname : "; echo "
"; echo "
"; ?> > -- Mensagem Original -- > > > > >Hello, > > > >I'm trying to insert data in the table, using PHP > >interface, but script creates an empty > >row without data. > >If you had similar problem, please, suggest > >a solution. > >I'm using Debian potato, PostgreSQL 7.2, > >Apache 1.3.24. > > > >Thank you in advance, > > > >ktt > > > > > > > > > >__________________________________________________ > >Do You Yahoo!? > >LAUNCH - Your Yahoo! Music Experience > >http://launch.yahoo.com > > > >---------------------------(end of > broadcast)--------------------------- > >TIP 2: you can get off all lists at once with the > unregister command > > (send "unregister YourEmailAddressHere" to > majordomo@postgresql.org) > > > > > > > ________________________________________ > A busca mais veloz e precisa da internet. Acesse > agora: http://www.zoom.com.br. > __________________________________________________ Do You Yahoo!? LAUNCH - Your Yahoo! Music Experience http://launch.yahoo.com ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org From mike@partner2partner.com Mon May 20 13:16:39 2002 Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id A9E62475CD8 for ; Mon, 20 May 2002 09:16:39 -0400 (EDT) Received: from conan.partner2partner.org (unknown [65.160.7.101]) by postgresql.org (Postfix) with SMTP id B76DC475B93 for ; Mon, 20 May 2002 09:16:38 -0400 (EDT) Received: (qmail 26245 invoked by uid 89); 20 May 2002 13:31:22 -0000 Message-ID: <20020520133122.26244.qmail@conan.partner2partner.org> References: <20020520120418.51354.qmail@web13902.mail.yahoo.com> In-Reply-To: <20020520120418.51354.qmail@web13902.mail.yahoo.com> From: "mike" To: pgsql-php@postgresql.org Subject: Re: unable to insert rows with php Date: Mon, 20 May 2002 13:31:22 GMT Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Archive-Number: 200205/76 X-Sequence-Number: 1208 ktt writes: > printf ("ID : %s
\n", $row[0]); > printf ("First Name: %s
\n", $row[1]); > printf ("Surname : %s
\n", $row[2]); > $query3 = "INSERT INTO friends (id, firstname, > surname) values (nextval('friends_id_seq'), > '$firstname', '$surname')"; You are not copying the values into the fields you are using in the INSERT statement: $firstname = $row[1]; $surname = $row[2]; Or $query3 = "INSERT INTO friends (id, firstname, surname) values (nextval('friends_id_seq'), '" . $row[1] . "', '" . $row[2] . "')"; Michael J. Upchurch Partner2Partner Communications mike@partner2partner.com 615.286.2199 From hierophant@pcisys.net Mon May 20 16:34:37 2002 Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 185C247688C for ; Mon, 20 May 2002 12:34:37 -0400 (EDT) Received: from leo.pcisys.net (leo.pcisys.net [207.76.102.240]) by postgresql.org (Postfix) with ESMTP id 6E787476332 for ; Mon, 20 May 2002 12:26:29 -0400 (EDT) Received: from [208.202.106.22] (moe1.meg106-22.cos.pcisys.net [208.202.106.22]) by leo.pcisys.net (8.12.1/8.12.1) via ESMTP id g4KGQXj2029177 for ; Mon, 20 May 2002 10:26:33 -0600 (MDT) env-from (hierophant@pcisys.net) User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.0.4 Date: Mon, 20 May 2002 10:27:08 -0600 Subject: Re: unable to insert rows with php From: Keary Suska To: Postgres-PHP Message-ID: In-Reply-To: <7DD34E6DF5CD1B4283DDAB96A855DCED2F334F@vodabemail1.vodacom.co.za> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-Archive-Number: 200205/78 X-Sequence-Number: 1210 on 5/20/02 7:18 AM, duncan.adams@vcontractor.co.za purportedly said: > > $query3 = "INSERT INTO friends (id, firstname, > surname) values (nextval('friends_id_seq'), > '$firstname', '$surname')"; > > where do u get the values for $firstname and $surname > should that not be $row[1] > and row[2] Actually, this code has a submit form, which is where I would assume the variable values come from. Make sure that register_gloabls is on. Add phpinfo() to the end of the script to check the current value of register_globals. If it is off, which is preferable, then you need to use $_POST (PHP v4.1+) or $HTTP_POST_VARS. As of 4.2.0, register_globals if OFF by default. > > -----Original Message----- > From: ktt [mailto:kestutis98@yahoo.com] > Sent: Monday, May 20, 2002 2:04 PM > To: angelo.rigo@globo.com > Cc: pgsql-php@postgresql.org > Subject: Re: [PHP] unable to insert rows with php > > > --- angelo.rigo@globo.com wrote: >> Can you show your code ? > > yes. it's written for test. > ------ > > > $db = pg_connect("dbname=friends user=kes"); > $query1 = "SELECT * FROM friends"; > $result = pg_exec($db,$query1); > if (!$result) {printf ("ERROR"); > exit; > } > $row = pg_fetch_row ($result,0); > printf ("ID : %s
\n", $row[0]); > printf ("First Name: %s
\n", $row[1]); > printf ("Surname : %s
\n", $row[2]); > $query3 = "INSERT INTO friends (id, firstname, > surname) values (nextval('friends_id_seq'), > '$firstname', '$surname')"; > $result = pg_exec($db, $query3); > if (!$result) { printf ("ERROR"); > $errormessage = pg_errormessage($db); > echo $errormessage; > exit; > } > pg_close(); > printf ("These values were inserted into the database > - %s %s", $firstname, $surname); > > echo"
method=\"post\">"; > echo "First Name : name=\"firstname\" size=\"40\" length=\"40\" > value=\"FirstName\">"; > echo "
Surname : name=\"surname\" size=\"40\" length=\"40\" > value=\"Surname\">"; > echo "
value=\"Submit\">"; > echo " value=\"Clear It\">
"; > > ?> > > > >> -- Mensagem Original -- >> >>> >>> Hello, >>> >>> I'm trying to insert data in the table, using PHP >>> interface, but script creates an empty >>> row without data. >>> If you had similar problem, please, suggest >>> a solution. >>> I'm using Debian potato, PostgreSQL 7.2, >>> Apache 1.3.24. >>> >>> Thank you in advance, >>> >>> ktt >>> >>> >>> >>> >>> __________________________________________________ >>> Do You Yahoo!? >>> LAUNCH - Your Yahoo! Music Experience >>> http://launch.yahoo.com >>> >>> ---------------------------(end of >> broadcast)--------------------------- >>> TIP 2: you can get off all lists at once with the >> unregister command >>> (send "unregister YourEmailAddressHere" to >> majordomo@postgresql.org) >>> >> >> >> >> >> ________________________________________ >> A busca mais veloz e precisa da internet. Acesse >> agora: http://www.zoom.com.br. >> > > > __________________________________________________ > Do You Yahoo!? > LAUNCH - Your Yahoo! Music Experience > http://launch.yahoo.com > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html > Keary Suska Esoteritech, Inc. "Leveraging Open Source for a better Internet"