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; > > ?> > > > > > 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
ID$myrow[0]
Título > value=$myrow[1] name=titulo size=150 > > maxlength=150>
Texto