Updating mysql data with php
When updating data in a table it is possible to either update specific rows, or to update all the rows in a table.These tasks are achieving using the SQL UPDATE statement combined with the SET and WHERE keywords.Information updated.";mysql_query("INSERT INTO viewed (uid,usecurecode,ulogin,uimg,ucountry,ucity,uage,vdate) VALUES ('$urlid','$_SESSION[$securecode]', '$_SESSION[$login]', '$_SESSION[$img1]', '$_SESSION[$country]', '$_SESSION[$city]', '$_SESSION[$age], 'now()')") or die("couldn't add new user");$sql = "UPDATE viewed SET uid='$urlid', usecurecode='".$_SESSION['SESS_SECURE_CODE']."', ulogin='".$_SESSION['SESS_LOGIN']."', uimg='".$_SESSION['SESS_IMG1']."', ucountry='".$_SESSION['SESS_COUNTRY']."', ucity='".$_SESSION['SESS_CITY']."', uage='".$_SESSION['SESS_AGE']."', vdate='now()'"; $result = mysql_query($sql) or die(mysql_error()); echo "Thank you!I've written a php page to load data from mysql table based on dropdown selection which is also populated from table, I then want some of the data to be able to be changed and then when submitted written back to the database.guido2004, I also tried updating my code with te code you supplied but I then get a HTTP 500 error screen Its really difficult though when I don't have anyone who can really show me the ropes.
And that is the ability to store the auto incremented field from the userinfo table into the table of the form that is being submitted.
As with most things in life, this is best demonstrated through an example.
The following SQL statement is designed to change the product description column of a row in a table where the prod_id column is equal to 12134.
In the above example, the SET section of the statement identifies the column to be updated and the value to which it is to be changed.
The WHERE section of the statement identifies the row, or rows to be updated.
Secondly, it needs to know which columns are to be updated, and the new values for those columns.