Re: question - Mailing list pgsql-sql

From Halley Pacheco de Oliveira
Subject Re: question
Date
Msg-id 20050830134333.31428.qmail@web52713.mail.yahoo.com
Whole thread Raw
In response to question  ("Matt A." <survivedsushi@yahoo.com>)
List pgsql-sql
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/


pgsql-sql by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: Performance issue
Next
From: Vivek Khera
Date:
Subject: Re: question