Re: PHP MySQL question

From: Date: Mon, 07 Apr 2003 16:26:40 +0000
Subject: Re: PHP MySQL question
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-19333@lists.php.net to get a copy of this message
I have a contact database that allows the user to make changes to his contacts. I link on the contact's name. Click on the link, and it pulls up that contact info in an editable form. When you click SUBMIT, that form passes it's data, via POST, to a PHP file. Here is most of the content of that PHP file: $ud_id=$_POST['ud_id']; $ud_First_Name=$_POST['ud_First_Name']; $ud_Last_Name=$_POST['ud_Last_Name']; $ud_Phone_Number=$_POST['ud_Phone_Number']; $ud_Email=$_POST['ud_Email']; $ud_Case_Type=$_POST['ud_Case_Type']; $ud_Comments=$_POST['ud_Comments']; mysql_connect($sql_server,$username,$password); $query="UPDATE contacts SET First_Name='$ud_First_Name', Last_Name='$ud_Last_Name', Phone_Number='$ud_Phone_Number', Email='$ud_Email', Case_Type='$ud_Case_Type', Comments='$ud_Comments' WHERE id='$ud_id'"; @mysql_select_db($database) or die( "Unable to select database"); mysql_query($query); mysql_close(); header("location: index.php") "Odcs" <odcs@rogers.com> wrote in message news:003d01c2fbcc$f2c6cc10$6401a8c0@p1... > 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. > > B. > >

« previous php.windows (#19333) next »