Re: Re: saving data

From: Date: Thu, 20 Jun 2002 01:22:56 +0000
Subject: Re: Re: saving data
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-19891@lists.php.net to get a copy of this message
If it were me... Javascript it to set cookie-variables. You really don't want that many roundtrips to the database if you can help it. Build up your cookie variables (array, object, whatever). So long as you don't close down your browser and you don't expire the cookie you're golden. You can drop connections (dialup), lose routes for a bit, etc. Everything's cached client-side and only transmitted on page-loads(including form submits.) So long as that cookie is valid your data is stored and you don't pay the penalty for updating the client from the server or updating the database via a ton of queries. Just an idea. -Mike ----- Original Message ----- From: "Adam Royle" <digitalbalance@mac.com> To: "Natividad Castro" <ncastro@cots.com>; <php-db@lists.php.net> Sent: Wednesday, June 19, 2002 3:01 PM Subject: Re: [PHP-DB] Re: saving data > Well, if they select a field the have previously updated, enter a new value, > the javascript will run again and update the same field. Apart from sending > new data and having an extra db connection, nothing bad happens - this is > because it is an UPDATE query. The query would have the same WHERE clause, > and update the same column, and only the value would change. > > Basically, using this technique, it is bad for the database (you might have > 10 separate queries, instead of 1), but this is the only way I see. You > could program it in a way that the first field they fill in does an INSERT > query and returns a unique row identifier, and all queries sent after that > are UPDATE queries which use the row identifier. > > If you need help constructing it, or figuring something out - I'm free to > help. > > Adam > > ----- Original Message ----- > From: Natividad Castro <ncastro@cots.com> > To: Adam Royle <digitalbalance@mac.com> > Sent: Thursday, June 20, 2002 6:05 AM > Subject: RE: [PHP-DB] Re: saving data > > > > Adan, > > I think this is a great idea, but what would happen if the user wants to > go > > back to change fields that he/she already typed in. > > Don't get me wrong your idea is great and I will try to make it work > > > > Thank you very much for your help > > Nato > > > > > > -----Original Message----- > > From: Adam Royle [mailto:digitalbalance@mac.com] > > Sent: Wednesday, June 19, 2002 8:08 AM > > To: Natividad Castro; php-db@lists.php.net > > Subject: [PHP-DB] Re: saving data > > > > > > Very interesting question. One way you could do this, is using > > javascript. Basically, you have two frames - one is the form, the other > > is an invisible frame. Then, create a javascript function which sends > > information about what field to update (and also the value to update to) > > to the invisble frame, and put this function in the onBlur bit of your > > form element. > > > > Am I making sense? Basically, what it would do is update the database > > after you click out (or tab or deselect a form element) > > > > example... > > > > this would be the HTML (depending on form contents and database design, > > you might have to include a few more javascript parameters) > > > > <input type="hidden" name="userID" value="<?= $userID > > ?>"> > > > > <input type="text" name="first_name" > > onBlur="updateDB(this.name,this.value,userID.value);"> > > > > and the javascript might be > > > > function updateDB(theName, theValue, userID){ > > top.invisbleFrame.href = > > > > "update.php?name="+theName+"&value="+theValue+"&userID="+userID; > > } > > > > of course if you have a complex form/or specific database thingys, this > > might be more complex, but basically this shows the data transfer > > between pages > > > > and in the invisbleFrame (update.php) you might have something like this: > > > > <?php > > dbConnect(); //obviously this is the database connection function > > > > $sql = "UPDATE tablename SET $name = '$value' WHERE userID = > > $userID";\ > > mysql_query($sql) > > > > ?> > > > > I hope that helps. If you need further help or explanation, ask!!! > > > > Adam > > > > > > > Hi to all, > > > Is it possible to save information from a form without being > > > submitted? I > > > know this question might be a little extrange for some of you. The > > > reason > > > why I'm asking this question is because I collect information from > > > different > > > places where users fill out a big form, they're complaining because > > > sometimes they are about to finish filling out the form when they lose > > > connection > > > I was wondering if there is a way to get this data temporaly and then > > > when > > > they reconnet to the system display all the fields with the information > > > they > > > already type in. > > > > > > If someone has any idea, please let me know > > > > > > Thanks in advanced > > > Nato > > > > > > -- > > 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

« previous php.db (#19891) next »