Re: Fw: Questions regarding inserting and updating data into a MySQL db

From: Date: Wed, 11 Sep 2002 14:18:02 +0000
Subject: Re: Fw: Questions regarding inserting and updating data into a MySQL db
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-115985@lists.php.net to get a copy of this message
comments below Axis Computers wrote: > > ----- Original Message ----- > From: Axis Computers > To: mysql@lists.mysql.com ; PHPSent: Tuesday, September 10, 2002 4:51 > PMSubject: Questions regarding inserting and updating data into a MySQL db > Hi, I'm developing a web application that uses forms for user input and then > after each form is filled shows something like Welcome Bob to our site ... > bla. bla... inserts data in a table and on the same page continues with the > rest of the data, and goes to another form and so on. I have no problems > inserting the data from the first form in the table, display the personalized > message, and then connect to the mySQL db, my problem is some fields in the > table which must be filled are null in this first instance, and then on the > second form they are filled,but my I don´t know how can I fill the gaps and > leave all the data in one row, because the first field auto increments, and > I'm worried the data instead of filling one row spreads accross two or > three. i.e First: BobLast: Evans//user submits form > > Isn't this where you do the INSERT? > > ///On the second formsays "Welcome Bob Evans and congratulations ... bla bla > ..."// inserts data into table > > get mysql_insert_id() here > $thisid=mysql_insert_id(); > > // Then asks for more dataAddress : Somewhere 555Ocupation: Something > > add the id, perhaps as a hidden input on the form. > <input type="hidden" name="thisid" value="<?php echo $thisid > ?>"> > > // user submits form// data is inserted into the table and the gaps are > filled or is updated ? > > instead of inserting, do an update. > UPDATE mytable > SET address='$Address', ocupation='Ocupation' > WHERE id=thisid > >>>> here is what I don't know if data is still on the same row and > effectively filled the gaps, or it is inserted into another road ... using > insert or update ? Thanks for your > tips TIA Rick __________________________________________________________________ > > ICQ#: 37031810 > Current ICQ status: [Image] > + More ways to contact me > __________________________________________________________________

« previous php.general (#115985) next »