Обсуждение: Update problem

Поиск
Список
Период
Сортировка

Update problem

От
Ângelo Marcos Rigo
Дата:
I have an update escript that works fine with text
fields but with an textarea version the script is
passing an empty value, for the "texto" field
Here is a snip of code that receives the values:

    $id = $_POST['id'];
    $titulo = $_POST['titulo'];
    $resumo = $_POST['resumo'];
    $texto = $_POST['texto'];
    print_r($texto);
    include 'db.php';
    $query = "UPDATE revista SET titulo='$titulo',
resumo='$resumo', texto='$texto' WHERE id='$id'";

here is the "texto" field where i do write the
modifications to be updated:

print ("<tr><td>Texto</td><td><textarea cols=\"90\"
rows=\"20\" value=\"$myrow[3]\"
name=\"texto\">$myrow[3]</textarea></td></tr>");

Thank´s 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



_______________________________________________________________________
Desafio AntiZona - Um emocionante desafio de perguntas e respostas que
te dá um Renault Clio, kits de eletrônicos, computadores, notebooks e
mochilas. Cadastre-se, participe e concorra!
www.cade.com.br/antizona

Re: Update problem

От
Ângelo Marcos Rigo
Дата:
 and i dont know why but if the "texto" field (wich is
a text data type on postgres) is empty and i write
something the update happen with success.



--- Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br>
escreveu: > I have an update escript that works fine
with text
> fields but with an textarea version the script is
> passing an empty value, for the "texto" field
> Here is a snip of code that receives the values:
>
>     $id = $_POST['id'];
>     $titulo = $_POST['titulo'];
>     $resumo = $_POST['resumo'];
>     $texto = $_POST['texto'];
>     print_r($texto);
>     include 'db.php';
>     $query = "UPDATE revista SET titulo='$titulo',
> resumo='$resumo', texto='$texto' WHERE id='$id'";
>
> here is the "texto" field where i do write the
> modifications to be updated:
>
> print ("<tr><td>Texto</td><td><textarea cols=\"90\"
> rows=\"20\" value=\"$myrow[3]\"
> name=\"texto\">$myrow[3]</textarea></td></tr>");
>
> Thank´s 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
>
>
>
>
_______________________________________________________________________
> Desafio AntiZona - Um emocionante desafio de
> perguntas e respostas que
> te dá um Renault Clio, kits de eletrônicos,
> computadores, notebooks e
> mochilas. Cadastre-se, participe e concorra!
> www.cade.com.br/antizona
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go 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



_______________________________________________________________________
Desafio AntiZona - Um emocionante desafio de perguntas e respostas que
te dá um Renault Clio, kits de eletrônicos, computadores, notebooks e
mochilas. Cadastre-se, participe e concorra!
www.cade.com.br/antizona

Re: Update problem

От
"scott.marlowe"
Дата:
On Tue, 19 Aug 2003, Ângelo Marcos Rigo wrote:

> I have an update escript that works fine with text
> fields but with an textarea version the script is
> passing an empty value, for the "texto" field
> Here is a snip of code that receives the values:
>
>     $id = $_POST['id'];
>     $titulo = $_POST['titulo'];
>     $resumo = $_POST['resumo'];
>     $texto = $_POST['texto'];
>     print_r($texto);
>     include 'db.php';
>     $query = "UPDATE revista SET titulo='$titulo',
> resumo='$resumo', texto='$texto' WHERE id='$id'";
>
> here is the "texto" field where i do write the
> modifications to be updated:
>
> print ("<tr><td>Texto</td><td><textarea cols=\"90\"
> rows=\"20\" value=\"$myrow[3]\"
> name=\"texto\">$myrow[3]</textarea></td></tr>");

Hi Ângelo, welcome to the php list.

Is the problem that the FORM is printed with an empty text area, or that,
after entering text into the textarea that it doesn't get inserted into
the database upon submission?


Re: Update problem

От
Ângelo Marcos Rigo
Дата:
Hi Scott

It´s strange but whith a little amount of text the
update works.
I have the same script with text field and it works
fine.

Now that i am using textarea because it handle a full
magazine article it is not working i do print $query
on the final script and return null.

It updates the title and abstract but the article wich
has a huge amount of text (with html tags inserted
from a built in javascript html editor).

Thank´s in advance

--- "scott.marlowe" <scott.marlowe@ihs.com> escreveu:
> On Tue, 19 Aug 2003, Ângelo Marcos Rigo wrote:
>
> > I have an update escript that works fine with text
> > fields but with an textarea version the script is
> > passing an empty value, for the "texto" field
> > Here is a snip of code that receives the values:
> >
> >     $id = $_POST['id'];
> >     $titulo = $_POST['titulo'];
> >     $resumo = $_POST['resumo'];
> >     $texto = $_POST['texto'];
> >     print_r($texto);
> >     include 'db.php';
> >     $query = "UPDATE revista SET titulo='$titulo',
> > resumo='$resumo', texto='$texto' WHERE id='$id'";
> >
> > here is the "texto" field where i do write the
> > modifications to be updated:
> >
> > print ("<tr><td>Texto</td><td><textarea
> cols=\"90\"
> > rows=\"20\" value=\"$myrow[3]\"
> > name=\"texto\">$myrow[3]</textarea></td></tr>");
>
> Hi Ângelo, welcome to the php list.
>
> Is the problem that the FORM is printed with an
> empty text area, or that,
> after entering text into the textarea that it
> doesn't get inserted into
> the database upon submission?
>
>
> ---------------------------(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



_______________________________________________________________________
Desafio AntiZona - Um emocionante desafio de perguntas e respostas que
te dá um Renault Clio, kits de eletrônicos, computadores, notebooks e
mochilas. Cadastre-se, participe e concorra!
www.cade.com.br/antizona

Re: Update problem

От
"scott.marlowe"
Дата:
I'm gonna guess that you've got CRs embedded or other text that needs
escaping.  Are you using pg_escape_string before the insert?

On Tue, 19 Aug 2003, Ângelo Marcos Rigo wrote:

> Hi Scott
>
> It´s strange but whith a little amount of text the
> update works.
> I have the same script with text field and it works
> fine.
>
> Now that i am using textarea because it handle a full
> magazine article it is not working i do print $query
> on the final script and return null.
>
> It updates the title and abstract but the article wich
> has a huge amount of text (with html tags inserted
> from a built in javascript html editor).
>
> Thank´s in advance
>
> --- "scott.marlowe" <scott.marlowe@ihs.com> escreveu:
> > On Tue, 19 Aug 2003, Ângelo Marcos Rigo wrote:
> >
> > > I have an update escript that works fine with text
> > > fields but with an textarea version the script is
> > > passing an empty value, for the "texto" field
> > > Here is a snip of code that receives the values:
> > >
> > >     $id = $_POST['id'];
> > >     $titulo = $_POST['titulo'];
> > >     $resumo = $_POST['resumo'];
> > >     $texto = $_POST['texto'];
> > >     print_r($texto);
> > >     include 'db.php';
> > >     $query = "UPDATE revista SET titulo='$titulo',
> > > resumo='$resumo', texto='$texto' WHERE id='$id'";
> > >
> > > here is the "texto" field where i do write the
> > > modifications to be updated:
> > >
> > > print ("<tr><td>Texto</td><td><textarea
> > cols=\"90\"
> > > rows=\"20\" value=\"$myrow[3]\"
> > > name=\"texto\">$myrow[3]</textarea></td></tr>");
> >
> > Hi Ângelo, welcome to the php list.
> >
> > Is the problem that the FORM is printed with an
> > empty text area, or that,
> > after entering text into the textarea that it
> > doesn't get inserted into
> > the database upon submission?
> >
> >
> > ---------------------------(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
>
>
>
> _______________________________________________________________________
> Desafio AntiZona - Um emocionante desafio de perguntas e respostas que
> te dá um Renault Clio, kits de eletrônicos, computadores, notebooks e
> mochilas. Cadastre-se, participe e concorra!
> www.cade.com.br/antizona
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faqs/FAQ.html
>


Re: Update problem

От
Ângelo Marcos Rigo
Дата:
No I am not using, i will try now. How do you use it
?pg_escape_string($sql) ?

--- "scott.marlowe" <scott.marlowe@ihs.com> escreveu:
> I'm gonna guess that you've got CRs embedded or
> other text that needs
> escaping.  Are you using pg_escape_string before the
> insert?
>
> On Tue, 19 Aug 2003, Ângelo Marcos Rigo wrote:
>
> > Hi Scott
> >
> > It´s strange but whith a little amount of text the
> > update works.
> > I have the same script with text field and it
> works
> > fine.
> >
> > Now that i am using textarea because it handle a
> full
> > magazine article it is not working i do print
> $query
> > on the final script and return null.
> >
> > It updates the title and abstract but the article
> wich
> > has a huge amount of text (with html tags inserted
> > from a built in javascript html editor).
> >
> > Thank´s in advance
> >
> > --- "scott.marlowe" <scott.marlowe@ihs.com>
> escreveu:
> > > On Tue, 19 Aug 2003, Ângelo Marcos Rigo wrote:
> > >
> > > > I have an update escript that works fine with
> text
> > > > fields but with an textarea version the script
> is
> > > > passing an empty value, for the "texto" field
> > > > Here is a snip of code that receives the
> values:
> > > >
> > > >     $id = $_POST['id'];
> > > >     $titulo = $_POST['titulo'];
> > > >     $resumo = $_POST['resumo'];
> > > >     $texto = $_POST['texto'];
> > > >     print_r($texto);
> > > >     include 'db.php';
> > > >     $query = "UPDATE revista SET
> titulo='$titulo',
> > > > resumo='$resumo', texto='$texto' WHERE
> id='$id'";
> > > >
> > > > here is the "texto" field where i do write the
> > > > modifications to be updated:
> > > >
> > > > print ("<tr><td>Texto</td><td><textarea
> > > cols=\"90\"
> > > > rows=\"20\" value=\"$myrow[3]\"
> > > >
> name=\"texto\">$myrow[3]</textarea></td></tr>");
> > >
> > > Hi Ângelo, welcome to the php list.
> > >
> > > Is the problem that the FORM is printed with an
> > > empty text area, or that,
> > > after entering text into the textarea that it
> > > doesn't get inserted into
> > > the database upon submission?
> > >
> > >
> > > ---------------------------(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
> >
> >
> >
> >
>
_______________________________________________________________________
> > Desafio AntiZona - Um emocionante desafio de
> perguntas e respostas que
> > te dá um Renault Clio, kits de eletrônicos,
> computadores, notebooks e
> > mochilas. Cadastre-se, participe e concorra!
> > www.cade.com.br/antizona
> >
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> >
> >
> http://www.postgresql.org/docs/faqs/FAQ.html
> >
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please
> send an appropriate
>       subscribe-nomail command to
> majordomo@postgresql.org so that your
>       message can get through to the mailing list
cleanly

=====
Â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



_______________________________________________________________________
Desafio AntiZona - Um emocionante desafio de perguntas e respostas que
te dá um Renault Clio, kits de eletrônicos, computadores, notebooks e
mochilas. Cadastre-se, participe e concorra!
www.cade.com.br/antizona

Re: Update problem

От
Ângelo Marcos Rigo
Дата:
Hi !!

I do this:

$titulo = pg_scape_string($_POST['titulo']);
$resumo = pg_scape_string($_POST['resumo']);
$texto = pg_scape_string($_POST['texto']);

but it do not work is it correct?


 --- "scott.marlowe" <scott.marlowe@ihs.com> escreveu:
> On Tue, 19 Aug 2003, Ângelo Marcos Rigo wrote:
>
> > Hi Scott
> >
> > You mean before i do insert the data in the
> database
> > do a clean up with:
> > $texto = pg_scape_string($_POST['texto']);
> > Crs mean carriage return?
> > why do it make the text dissapear?
>
> Not sure, I'm just guessing.  Anytime you want to
> put text into the
> database you need to pg_escape_string($field) each
> field to make sure that
> ' characters get escaped.  You can use
> remove_slashes() to get it off.
> I'm not sure why there's no pg_unescape_string()
> though.
>

=====
Â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



_______________________________________________________________________
Desafio AntiZona - Um emocionante desafio de perguntas e respostas que
te dá um Renault Clio, kits de eletrônicos, computadores, notebooks e
mochilas. Cadastre-se, participe e concorra!
www.cade.com.br/antizona

Re: Update problem

От
Gerd Terlutter
Дата:
pg_scape_string() ?
better
pg_escape_string()  ?
Ângelo Marcos Rigo wrote:
> Hi !!
>
> I do this:
>
> $titulo = pg_scape_string($_POST['titulo']);
> $resumo = pg_scape_string($_POST['resumo']);
> $texto = pg_scape_string($_POST['texto']);
>
> but it do not work is it correct?
>>>do a clean up with:
>>>$texto = pg_scape_string($_POST['texto']);
>>Not sure, I'm just guessing.  Anytime you want to
>>put text into the
>>database you need to pg_escape_string($field) each


--
--------------------------------------------------------
# Gerd Terlutter        | Mueller+Blanck Software GmbH #
# gerd@MplusB.de        | Gutenbergring 38             #
# gerd.terlutter@web.de | D-22848 Noderstedt           #
# tel:0171/6992579      | tel:+49 40 500 171-1         #
# Buero:040/500171-17   | fax:+49 40 500 171-71        #
--------------------------------------------------------



Re: Update problem

От
Ângelo Marcos Rigo
Дата:
Thank´s the pg_escape_string works, i still turn the
wrap atributte from the textarea to virtual

But at the update part of the scripts doing a print
query return me:

UPDATE revista SET titulo='ASILO PADRE CACIQUE ',
resumo='Sociedade Humanitária Padre Cacique fundada em
12 de maio de 1982, entidade particular com fins
beneficentes.', texto='' WHERE id='16'Estes valores
foram atualizados:

The texto (or text) field  still is passed by empty

here is the update_2.php (there is update.php and
update_1.php)

<?php

    $id = $_POST['id'];
    $titulo = pg_escape_string($_POST['titulo']);
    $resumo = pg_escape_string($_POST['resumo']);
    $texto = pg_escape_string($_POST['texto']);
    var_dump($texto);
    print("<p>");
    print_r($texto);
    print("<p>");
    include 'db.php';
    $query = "UPDATE table SET titulo='$titulo',
resumo='$resumo', texto='$texto' WHERE id='$id'";
    print $query;
    $result = pg_query($db, $query);
    if (!$result) {printf ("ERROR"); exit;}
    print ("Estes valores foram atualizados:<P> -
$id<BR>- $titulo<BR>- $resumo<BR>- $texto<BR>");
    pg_close($db);

?>




--- Gerd Terlutter <gerd@MplusB.de> escreveu: >
pg_scape_string() ?
> better
> pg_escape_string()  ?
> Ângelo Marcos Rigo wrote:
> > Hi !!
> >
> > I do this:
> >
> > $titulo = pg_scape_string($_POST['titulo']);
> > $resumo = pg_scape_string($_POST['resumo']);
> > $texto = pg_scape_string($_POST['texto']);
> >
> > but it do not work is it correct?
> >>>do a clean up with:
> >>>$texto = pg_scape_string($_POST['texto']);
> >>Not sure, I'm just guessing.  Anytime you want to
> >>put text into the
> >>database you need to pg_escape_string($field) each
>
>
> --
>
--------------------------------------------------------
> # Gerd Terlutter        | Mueller+Blanck Software
> GmbH #
> # gerd@MplusB.de        | Gutenbergring 38
>   #
> # gerd.terlutter@web.de | D-22848 Noderstedt
>   #
> # tel:0171/6992579      | tel:+49 40 500 171-1
>   #
> # Buero:040/500171-17   | fax:+49 40 500 171-71
>   #
>
--------------------------------------------------------
>
>

=====
Â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



_______________________________________________________________________
Desafio AntiZona - Um emocionante desafio de perguntas e respostas que
te dá um Renault Clio, kits de eletrônicos, computadores, notebooks e
mochilas. Cadastre-se, participe e concorra!
www.cade.com.br/antizona