From angelo_rigo@yahoo.com.br Thu Aug 14 13:47:22 2003 X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id B1B55D1C4D5 for ; Thu, 14 Aug 2003 13:47:22 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 16723-09 for ; Thu, 14 Aug 2003 10:45:47 -0300 (ADT) Received: from web14805.mail.yahoo.com (web14805.mail.yahoo.com [216.136.224.221]) by svr1.postgresql.org (Postfix) with SMTP id 188CDD1F434 for ; Thu, 14 Aug 2003 10:46:42 -0300 (ADT) Message-ID: <20030814134646.77797.qmail@web14805.mail.yahoo.com> Received: from [200.219.69.252] by web14805.mail.yahoo.com via HTTP; Thu, 14 Aug 2003 10:46:46 ART Date: Thu, 14 Aug 2003 10:46:46 -0300 (ART) From: =?iso-8859-1?q?=C2ngelo=20Marcos=20Rigo?= Subject: Update script To: pgsql-php@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/55 X-Sequence-Number: 2232 Hi I have a script to update some records in a postgresql database. when i do modify what i have to modify it give me the warning: Warning: pg_query() query failed: ERROR: pg_atoi: zero-length string in /var/www/html/adm/modificar_2.php on line 24 ERROR this is line 24: $result = pg_query($db, $query); this is modificar_2.php : - $titulo
- $texto
"); pg_close($db); ?> This is a snip from modificar_1.php "); print (""); print (""); $row++; } while ($row < $numrows); ?> Thanks in advance ===== Ângelo Marcos Rigo AMR Informática (51) 3348 0870 Rua Pe. Alois Kades 400/210 Porto Alegre /RS/Brasil http://amr.freezope.org angelo_rigo@yahoo.com.br _______________________________________________________________________ Conheça o novo Cadê? - Mais rápido, mais fácil e mais preciso. Toda a web, 42 milhões de páginas brasileiras e nova busca por imagens! http://www.cade.com.br From bc@vio.ro Thu Aug 14 14:03:46 2003 X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 683F0D1F6FC for ; Thu, 14 Aug 2003 14:03:46 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 23358-06 for ; Thu, 14 Aug 2003 11:02:11 -0300 (ADT) Received: from mail1.dr.myx.net (mail1.dr.myx.net [217.10.193.161]) by svr1.postgresql.org (Postfix) with ESMTP id AFE52D1F482 for ; Thu, 14 Aug 2003 10:59:17 -0300 (ADT) Received: from workstation24 (unknown [81.12.137.146]) by mail1.dr.myx.net (mydomain.myx.net) with ESMTP id 69585300A0A for ; Thu, 14 Aug 2003 16:59:19 +0300 (EEST) Message-ID: <001901c3626c$076efc90$0600a8c0@fix.ro> From: "Viorel Dragomir" To: References: <20030814134646.77797.qmail@web14805.mail.yahoo.com> Subject: Re: Update script Date: Thu, 14 Aug 2003 16:57:41 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/56 X-Sequence-Number: 2233 ----- Original Message ----- From: "Ângelo Marcos Rigo" To: Sent: Thursday, August 14, 2003 4:46 PM Subject: [PHP] Update script > Hi > > I have a script to update some records in a postgresql > database. when i do modify what i have to modify it > give me the warning: > > Warning: pg_query() query failed: ERROR: pg_atoi: > zero-length string in > /var/www/html/adm/modificar_2.php on line 24 > ERROR > > this is line 24: > $result = pg_query($db, $query); > > this is modificar_2.php : > > $id = $_POST['id']; Since this is the only thing that match an integer value, try to use $id = $_POST['id'] + 0; in case there is no id sent. You'll don't get any results [i hope there is no id==0] but u'll don't have an error on your query. Because id is integer try not to use *where id='$id'*. Use *where id=$id* instead. > $titulo = $_POST['titulo']; > $texto = $_POST['texto']; > > include 'db.php'; > $query = "UPDATE table SET titulo='$titulo', > texto='$texto' WHERE id='$id'"; > $result = pg_query($db, $query); > if (!$result) {printf ("ERROR"); exit;} > print ("Estes valores foram atualizados:

- > $titulo
- $texto
"); > pg_close($db); > ?> > > This is a snip from modificar_1.php > > $id = $_POST['id']; > $titulo = $_POST['titulo']; > $texto = $_POST['texto']; > > include 'db.php'; > $query = "SELECT id, titulo, texto FROM table WHERE > id='$id'"; > $result = pg_exec($db, $query); > if (!$result) {printf ("ERROR"); exit;} > $numrows = pg_numrows($result); > $row=0; > ?> >

ID$myrow[0]
Título
Texto
> do { > $myrow = pg_fetch_row ($result, $row); > //print_r($myrow); > print (""); > print (""); > print (""); > $row++; > } > while ($row < $numrows); > ?> > > Thanks in advance > > > ===== > Ângelo Marcos Rigo > AMR Informática > (51) 3348 0870 > Rua Pe. Alois Kades 400/210 > Porto Alegre /RS/Brasil > http://amr.freezope.org > angelo_rigo@yahoo.com.br > > > > _______________________________________________________________________ > Conheça o novo Cadê? - Mais rápido, mais fácil e mais preciso. > Toda a web, 42 milhões de páginas brasileiras e nova busca por imagens! > http://www.cade.com.br > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org From angelo_rigo@yahoo.com.br Thu Aug 14 17:00:36 2003 X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id A9D7FD1C9D6 for ; Thu, 14 Aug 2003 17:00:36 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 87343-05 for ; Thu, 14 Aug 2003 14:00:21 -0300 (ADT) Received: from web14806.mail.yahoo.com (web14806.mail.yahoo.com [216.136.224.222]) by svr1.postgresql.org (Postfix) with SMTP id 9F051D1F4AB for ; Thu, 14 Aug 2003 13:55:20 -0300 (ADT) Message-ID: <20030814165520.69512.qmail@web14806.mail.yahoo.com> Received: from [200.219.69.252] by web14806.mail.yahoo.com via HTTP; Thu, 14 Aug 2003 13:55:20 ART Date: Thu, 14 Aug 2003 13:55:20 -0300 (ART) From: =?iso-8859-1?q?=C2ngelo=20Marcos=20Rigo?= Subject: Re: Update script To: Viorel Dragomir , pgsql-php@postgresql.org In-Reply-To: <001901c3626c$076efc90$0600a8c0@fix.ro> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/58 X-Sequence-Number: 2235 It work in half : I get the message that the values where updated but the values are not really updated > > > Hi > > > > I have a script to update some records in a > postgresql > > database. when i do modify what i have to modify > it > > give me the warning: > > > > Warning: pg_query() query failed: ERROR: pg_atoi: > > zero-length string in > > /var/www/html/adm/modificar_2.php on line 24 > > ERROR > > > > this is line 24: > > $result = pg_query($db, $query); > > > > this is modificar_2.php : > > > > > $id = $_POST['id']; > > Since this is the only thing that match an integer > value, try to use > $id = $_POST['id'] + 0; > in case there is no id sent. You'll don't get any > results [i hope there is > no id==0] but u'll don't have an error on your > query. > Because id is integer try not to use *where > id='$id'*. Use *where id=$id* > instead. > > > $titulo = $_POST['titulo']; > > $texto = $_POST['texto']; > > > > include 'db.php'; > > $query = "UPDATE table SET titulo='$titulo', > > texto='$texto' WHERE id='$id'"; > > $result = pg_query($db, $query); > > if (!$result) {printf ("ERROR"); exit;} > > print ("Estes valores foram atualizados:

- > > $titulo
- $texto
"); > > pg_close($db); > > ?> > > > > This is a snip from modificar_1.php > > > > > $id = $_POST['id']; > > $titulo = $_POST['titulo']; > > $texto = $_POST['texto']; > > > > include 'db.php'; > > $query = "SELECT id, titulo, texto FROM table > WHERE > > id='$id'"; > > $result = pg_exec($db, $query); > > if (!$result) {printf ("ERROR"); exit;} > > $numrows = pg_numrows($result); > > $row=0; > > ?> > >

ID$myrow[0]
Título value=$myrow[1] name=titulo size=150 > maxlength=150>
Texto
> > > do { > > $myrow = pg_fetch_row ($result, $row); > > //print_r($myrow); > > print (""); > > print (""); > > print (""); > > $row++; > > } > > while ($row < $numrows); > > ?> > > > > Thanks in advance > > > > > > ===== > > Ângelo Marcos Rigo > > AMR Informática > > (51) 3348 0870 > > Rua Pe. Alois Kades 400/210 > > Porto Alegre /RS/Brasil > > http://amr.freezope.org > > angelo_rigo@yahoo.com.br > > > > > > > > > _______________________________________________________________________ > > Conheça o novo Cadê? - Mais rápido, mais fácil e > mais preciso. > > Toda a web, 42 milhões de páginas brasileiras e > nova busca por imagens! > > http://www.cade.com.br > > > > ---------------------------(end of > broadcast)--------------------------- > > TIP 6: Have you searched our list archives? > > > > http://archives.postgresql.org > > > ---------------------------(end of > broadcast)--------------------------- > TIP 2: you can get off all lists at once with the > unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) ===== Ângelo Marcos Rigo AMR Informática (51) 3348 0870 Rua Pe. Alois Kades 400/210 Porto Alegre /RS/Brasil http://amr.freezope.org angelo_rigo@yahoo.com.br _______________________________________________________________________ Conheça o novo Cadê? - Mais rápido, mais fácil e mais preciso. Toda a web, 42 milhões de páginas brasileiras e nova busca por imagens! http://www.cade.com.br From busby@pnts.com Thu Aug 14 20:17:40 2003 X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id D87A3D1F5E6 for ; Thu, 14 Aug 2003 20:17:40 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 66200-10 for ; Thu, 14 Aug 2003 17:17:31 -0300 (ADT) Received: from seapdc01.PNTS (ip63.c216.blk1.bel.nwlink.com [209.20.216.63]) by svr1.postgresql.org (Postfix) with ESMTP id E1E9AD1F48B for ; Thu, 14 Aug 2003 17:14:29 -0300 (ADT) Received: from busbydev (BUSBY-DEV [10.0.0.17]) by seapdc01.PNTS with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id PRCQ9YDW; Thu, 14 Aug 2003 13:31:15 -0700 Message-ID: <052b01c3629f$aa27e810$1100000a@busbydev> Reply-To: "David Busby" From: "David Busby" To: =?iso-8859-1?Q?=C2ngelo_Marcos_Rigo?= , References: <20030814134646.77797.qmail@web14805.mail.yahoo.com> Subject: Re: Update script Date: Thu, 14 Aug 2003 13:07:19 -0700 Organization: Pacific Northwest Ticket Service MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.9 tagged_above=0.0 required=5.0 tests=BAYES_30, HTML_20_30, HTML_TAG_BALANCE_TABLE, REFERENCES X-Spam-Level: X-Archive-Number: 200308/59 X-Sequence-Number: 2236 Do: print $query; in your code to look at the query you send, atoi = ASCII to Integer. It is failing to convert a null string into integer, your query is malformed. /B ----- Original Message ----- From: "Ângelo Marcos Rigo" To: Sent: Thursday, August 14, 2003 06:46 Subject: [PHP] Update script Hi I have a script to update some records in a postgresql database. when i do modify what i have to modify it give me the warning: Warning: pg_query() query failed: ERROR: pg_atoi: zero-length string in /var/www/html/adm/modificar_2.php on line 24 ERROR this is line 24: $result = pg_query($db, $query); this is modificar_2.php : - $titulo
- $texto
"); pg_close($db); ?> This is a snip from modificar_1.php
ID$myrow[0]
Título > value=$myrow[1] name=titulo size=150 > > maxlength=150>
Texto
"); print (""); print (""); $row++; } while ($row < $numrows); ?> Thanks in advance ===== Ângelo Marcos Rigo AMR Informática (51) 3348 0870 Rua Pe. Alois Kades 400/210 Porto Alegre /RS/Brasil http://amr.freezope.org angelo_rigo@yahoo.com.br _______________________________________________________________________ Conheça o novo Cadê? - Mais rápido, mais fácil e mais preciso. Toda a web, 42 milhões de páginas brasileiras e nova busca por imagens! http://www.cade.com.br ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org From col@mportal.hu Thu Aug 14 23:49:32 2003 X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id BF1A0D1B524 for ; Thu, 14 Aug 2003 23:49:32 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 32115-06 for ; Thu, 14 Aug 2003 20:49:25 -0300 (ADT) Received: from news.hub.org (unknown [64.117.224.194]) by svr1.postgresql.org (Postfix) with ESMTP id 33DFBD1B56B for ; Thu, 14 Aug 2003 20:49:22 -0300 (ADT) Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] (may be forged)) by news.hub.org (8.12.9/8.12.9) with ESMTP id h7ENnLek061204 for ; Thu, 14 Aug 2003 23:49:21 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id h7ENKKWg053874 for pgsql-php@postgresql.org; Thu, 14 Aug 2003 23:20:20 GMT From: CoL X-Newsgroups: comp.databases.postgresql.interfaces.php Subject: Re: Update script Date: Fri, 15 Aug 2003 01:22:32 +0200 Organization: Hub.Org Networking Services Lines: 36 Message-ID: References: <20030814134646.77797.qmail@web14805.mail.yahoo.com> Reply-To: col@mportal.hu Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5a) Gecko/20030718 X-Accept-Language: hu, en-us, en In-Reply-To: <20030814134646.77797.qmail@web14805.mail.yahoo.com> To: pgsql-php@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/60 X-Sequence-Number: 2237 Hi, =C2ngelo Marcos Rigo wrote, On 8/14/2003 3:46 PM: > Hi=20 >=20 > I have a script to update some records in a postgresql > database. when i do modify what i have to modify it > give me the warning:=20 >=20 > Warning: pg_query() query failed: ERROR: pg_atoi: > zero-length string in > /var/www/html/adm/modificar_2.php on line 24 > ERROR >=20 > this is line 24: > $result =3D pg_query($db, $query); >=20 > this is modificar_2.php : >=20 > $id =3D $_POST['id']; > $titulo =3D $_POST['titulo']; > $texto =3D $_POST['texto']; >=20 > include 'db.php';=20 > $query =3D "UPDATE table SET titulo=3D'$titulo', > texto=3D'$texto' WHERE id=3D'$id'"; print $query; You will get: UPDATE table SET titulo=3D'somthing',texto=3D'text' WHERE id=3D'' And your pg version is >=3D 7.2, where you can not insert '' string in=20 integer type. cast $id as integer, '".($id+0)."' or intval or others. C. From angelo_rigo@yahoo.com.br Fri Aug 15 10:54:00 2003 X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id DB173D1C50D for ; Fri, 15 Aug 2003 10:54:00 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 28331-06 for ; Fri, 15 Aug 2003 07:53:52 -0300 (ADT) Received: from web14802.mail.yahoo.com (web14802.mail.yahoo.com [216.136.224.218]) by svr1.postgresql.org (Postfix) with SMTP id 87DB9D1B539 for ; Fri, 15 Aug 2003 07:53:49 -0300 (ADT) Message-ID: <20030815105352.63670.qmail@web14802.mail.yahoo.com> Received: from [200.219.69.252] by web14802.mail.yahoo.com via HTTP; Fri, 15 Aug 2003 07:53:52 ART Date: Fri, 15 Aug 2003 07:53:52 -0300 (ART) From: =?iso-8859-1?q?=C2ngelo=20Marcos=20Rigo?= Subject: Re: Update script To: col@mportal.hu Cc: pgsql-php@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/61 X-Sequence-Number: 2238 Hi Col Thank´s for the postgre version note my problem was that i just forget the name=id atribute in the textfield Best regards --- CoL escreveu: > Hi, > > > Ângelo Marcos Rigo wrote, On 8/14/2003 3:46 PM: > > Hi > > > > I have a script to update some records in a > postgresql > > database. when i do modify what i have to modify > it > > give me the warning: > > > > Warning: pg_query() query failed: ERROR: pg_atoi: > > zero-length string in > > /var/www/html/adm/modificar_2.php on line 24 > > ERROR > > > > this is line 24: > > $result = pg_query($db, $query); > > > > this is modificar_2.php : > > > > > $id = $_POST['id']; > > $titulo = $_POST['titulo']; > > $texto = $_POST['texto']; > > > > include 'db.php'; > > $query = "UPDATE table SET titulo='$titulo', > > texto='$texto' WHERE id='$id'"; > print $query; You will get: > UPDATE table SET titulo='somthing',texto='text' > WHERE id='' > > And your pg version is >= 7.2, where you can not > insert '' string in > integer type. cast $id as integer, '".($id+0)."' or > intval or others. > > C. > > > ---------------------------(end of > broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster ===== Ângelo Marcos Rigo AMR Informática (51) 3348 0870 Rua Pe. Alois Kades 400/210 Porto Alegre /RS/Brasil http://amr.freezope.org angelo_rigo@yahoo.com.br _______________________________________________________________________ Conheça o novo Cadê? - Mais rápido, mais fácil e mais preciso. Toda a web, 42 milhões de páginas brasileiras e nova busca por imagens! http://www.cade.com.br
ID$myrow[0]
Título
Texto