pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Halley Pacheco de Oliveira <halleypo@yahoo.com.br>
To: pgsql-sql@postgresql.org
Cc: Matt A. <survivedsushi@yahoo.com>
Subject: Re: question
Date: Tue, 30 Aug 2005 13:43:33 +0000 (GMT)
Message-ID: <20050830134333.31428.qmail@web52713.mail.yahoo.com> (raw)

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/



view thread (19+ messages)  latest in thread

Message-ID: <20050830134333.31428.qmail@web52713.mail.yahoo.com>
Permalink:  ../20050830134333.31428.qmail@web52713.mail.yahoo.com/
Also on:    postgresql.org/message-id/20050830134333.31428.qmail@web52713.mail.yahoo.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: halleypo@yahoo.com.br, survivedsushi@yahoo.com
  Subject: Re: question
  In-Reply-To: <20050830134333.31428.qmail@web52713.mail.yahoo.com>

* 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