pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: CoL <col@mportal.hu>
To: pgsql-php@postgresql.org
Subject: Re: Update script
Date: Fri, 15 Aug 2003 01:22:32 +0200
Message-ID: <bhh5fj$1jua$1@news.hub.org> (raw)
In-Reply-To: <20030814134646.77797.qmail@web14805.mail.yahoo.com>
References: <20030814134646.77797.qmail@web14805.mail.yahoo.com>

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 :
> 
> <?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.




view thread (6+ messages)  latest in thread

Message-ID: <bhh5fj$1jua$1@news.hub.org>
Permalink:  ../bhh5fj$1jua$1@news.hub.org/
Also on:    postgresql.org/message-id/bhh5fj$1jua$1@news.hub.org

 · 

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: col@mportal.hu
  Subject: Re: Update script
  In-Reply-To: <bhh5fj$1jua$1@news.hub.org>
  References: <20030814134646.77797.qmail@web14805.mail.yahoo.com> <bhh5fj$1jua$1@news.hub.org>

* 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