Updating table in mysql sex dating chatrooms
The first part of the update script uses the single record selection from last week but adds a little HTML to it to make it more useful.
This query could then be integrated into a simple script: $ud_id=$_POST['ud_id']; $ud_first=$_POST['ud_first']; $ud_last=$_POST['ud_last']; $ud_phone=$_POST['ud_phone']; $ud_mobile=$_POST['ud_mobile']; $ud_fax=$_POST['ud_fax']; $ud_email=$_POST['ud_email']; $ud_web=$_POST['ud_web']; $username="username"; $password="password"; $database="your_database"; mysql_connect(localhost,$username,$password); $query="UPDATE contacts SET first='$ud_first', last='$ud_last', phone='$ud_phone', mobile='$ud_mobile', fax='$ud_fax', email='$ud_email', web='$ud_web' WHERE id='$ud_id'"; mysql_query($query); echo "Record Updated"; mysql_close(); At this time it seems appropriate to mention another use of loops with a database.
In the example, if you did ' REPLACE INTO table (id, age) values (1, 19) then the name field would become [email protected] Hence you need to have DELETE privileges, which it's best not to have if you don't need them.
My environment's database user only has INSERT and UPDATE permissions, so REPLACE won't work.actually i don't need to add the new values to another row with a new ID instead i want to replace the existing values of id = 1 with this values.
I know all of you allude to this, but I want to be explicit for others.
If the ID you insert is NOT the PRIMARY KEY or UNIQUE, then this will not work.
This didn't initially work for me because my ID was not unique.