Re: Re: Subject: PHP MySQL question

From: Date: Sun, 06 Apr 2003 23:00:43 +0000
Subject: Re: Re: Subject: PHP MySQL question
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-19325@lists.php.net to get a copy of this message
i think one of the best ways to do this is a simple if statement for each value... if the form item contains a value then add it to the update string, if not, don't... then you can process the update SQL in one go... that's how i do it anyway... ----- Original Message ----- From: "Neil Smith" <neil@fresh-toast.uklinux.net> To: <php-windows@lists.php.net> Cc: <odcs@rogers.com> Sent: Sunday, April 06, 2003 1:35 PM Subject: [PHP-WIN] Re: Subject: PHP MySQL question > Surely it would be easier to just write one query which updates the whole > entry, regardless of which items have changed ? Might cost a few more > electrons, but hey, saves making work for yourself :-) > > Just make sure to populate your form with the existing data then submit the > lot as if it was a new entry (but send the entry ID so you can do the > update). Sorry can't be more specific, but your question was rather wooly. > > Cheers, > Neil Smith > > At 23:49 05/04/2003 +0000, you wrote: > >Message-ID: <003d01c2fbcc$f2c6cc10$6401a8c0@p1> > >From: "ODCS" <odcs@rogers.com> > >To: "PHP Windows" <php-windows@lists.php.net> > >Date: Sat, 5 Apr 2003 18:41:57 -0500 > >MIME-Version: 1.0 > >Content-Type: text/plain; > > charset="iso-8859-1" > >Content-Transfer-Encoding: 7bit > >Subject: PHP MySQL question > > > >I have a database of user inputted information and need to create a page > >where the user can update their information. The user will log in using > >their name and password and then be forwarded to a form with all the fields > >they can update - but what is the best way to write the records to the > >database. Lets say the user wants to update 3 out of ten fields - would I > >have to write a query for each field and write them one by one, or is there > >a better way to do this. Any thoughts on this are appreciated. > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.windows (#19325) next »