X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 36312D8477 for ; Tue, 30 Aug 2005 10:43:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64500-01 for ; Tue, 30 Aug 2005 13:43:32 +0000 (GMT) Received: from web52713.mail.yahoo.com (web52713.mail.yahoo.com [206.190.48.236]) by svr1.postgresql.org (Postfix) with SMTP id 76D6ED6E95 for ; Tue, 30 Aug 2005 10:43:30 -0300 (ADT) Received: (qmail 31430 invoked by uid 60001); 30 Aug 2005 13:43:33 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.br; h=Message-ID:Received:Date:From:Subject:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding; b=i71ufrfIB6bf3UNlwZROmGZZd6VyfcT+Okujgw2r1AK9HnxzelistRg71UNilC43uvfLCfoKhjEIEIFPl131YCRE0b/DsfSSerASFtZyqtbXD/o1wgCMLjivbBc6aUb4iTUTr6bdeeRKGCXX3DFFo5NYbrP1qkYoa6mhxX/VvXY= ; Message-ID: <20050830134333.31428.qmail@web52713.mail.yahoo.com> Received: from [201.8.20.58] by web52713.mail.yahoo.com via HTTP; Tue, 30 Aug 2005 13:43:33 GMT Date: Tue, 30 Aug 2005 13:43:33 +0000 (GMT) From: Halley Pacheco de Oliveira Subject: Re: question To: pgsql-sql@postgresql.org Cc: "Matt A." MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.38 required=5 tests=[AWL=0.006, DNS_FROM_RFC_ABUSE=0.374] X-Spam-Level: X-Archive-Number: 200508/283 X-Sequence-Number: 22511 In PHP I use this code with a prepared statement to insert null in the field justif_emenda when the value in the form is an empty string or a string with only spaces. I hope this will help you. $sql = "INSERT INTO tbl_emenda (" . "id_emenda, subtipo_emenda, tipo_emenda, " . "nome_autor, titulo_autor, login_autor, " . "cod_acao_gov, nome_acao_gov, " . "texto_emenda, justif_emenda) " . "VALUES(?,?,?,?,?,?,?,?,?,nullif(trim(' ' from ?),''))"; $stmt = $conn->Prepare($sql); if (!$conn->Execute($stmt, array( $id_emenda, 'S', 'Aditiva', $_SESSION['nome_autor'], $_SESSION['titulo_autor'], $_SESSION['login_autor'], $_REQUEST['selCodAcaoGov'], $_REQUEST['txtNomeAcaoGov'], $_REQUEST['txtTexto'], $_REQUEST['txtJustif'] ))) { erroSQL($conn, $sql); die("Erro.."); } _______________________________________________________ Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! http://br.acesso.yahoo.com/