Re: MySQL Returns Error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



if i understand your question. why not take a different approach.  when the
form is submitted do your updates/inserts and then forward the page with
the header() function to another page, even if it is the same page, but
with a different set of variables set on the page, the idea being to remove
the $_POST/$_GET arrays containing your data

so at the end of your insert
header("Location: ".$_SERVER['PHP_SELF']."?inserted=true");

you can send them from whence they came with
header("Location: ".$_SERVER['HTTP_REFERER']);

hth
jd




                                                                                                                                       
                      "Jeff"                                                                                                           
                      <jroth1@telus.net        To:       php-db@lists.php.net                                                          
                      >                        cc:                                                                                     
                                               Subject:  Re:  MySQL Returns Error                                              
                      08/05/2003 06:41                                                                                                 
                      PM                                                                                                               
                                                                                                                                       
                                                                                                                                       




I'm unsure of both suggestions, can someone go into more detail?


"Richard Hutchins" <Richard.Hutchins@Getingeusa.com> wrote in message
1EA7D3AE70ACD511BE6D006097A78C1E033C91A4@USROCEXC">news:1EA7D3AE70ACD511BE6D006097A78C1E033C91A4@USROCEXC...
> So create a hidden input field on the page called cur_id and set its
value
> to the id of the record being displayed. If no record is currently being
> displayed, set it to -1.
>
> When you get ready to handle the form data, check the $_POST['cur_id']
> variable. If it's set to -1, perform an INSERT. If it's set to anything
> else, perform an UPDATE using the value of $_POST['cur_id'] in your WHERE
> clause.
>
> I'm sure there are other ways to handle this. This is how I have handled
it
> in the past though.
>
> > -----Original Message-----
> > From: Jeff [mailto:jroth1@telus.net]
> > Sent: Tuesday, August 05, 2003 3:52 PM
> > To: php-db@lists.php.net
> > Subject: Re:  MySQL Returns Error
> >
> >
> > Oops, my mistake, it's not a blank entry  - it re enters the
> > last entry.
> >
> > I can hit F5 or click refresh 1000 times and it will enter
> > the last entry
> > 1000 times.
> >
> >
> > "Jeff" <jroth1@telus.net> wrote in message
> > 20030805193545.88580.qmail@pb1.pair.com">news:20030805193545.88580.qmail@pb1.pair.com...
> > > I tried putting that in a few diffrent places, same result
> > - is there
> > > somewhere special I need to put that?
> > >
> > > "Matt Schroebel" <MSchroebel@hsus.org> wrote in message
> > > D4DB668A680B2549AE977FB0B193E2E80144F3B4@email.hsus.org">news:D4DB668A680B2549AE977FB0B193E2E80144F3B4@email.hsus.org...
> > >
> > >
> > > > -----Original Message-----
> > > > From: Jeff [mailto:jroth1@telus.net]
> > > > Sent: Tuesday, August 05, 2003 3:15 PM
> > > > To: php-db@lists.php.net
> > > > Subject: Re:  MySQL Returns Error
> > > >
> > > > Every time I access or refresh the page, it adds one blank
> > > > entry to the DB.
> > > >
> > > > Maybe I have the insert query in the wrong place?
> > >
> > > if ('POST' == $_SERVER['REQUEST_METHOD']) {
> > > //someone submitted the form with method="post"
> > > // so validate input, and if okay store it in db
> > > }
> > >
> > >
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux