0
Can anyone help me with writing a code for editing records previously entered in a MySQL database table, with the help of PHP?
So, I'm creating a webpage where I display the information of a user in a table by entering his/her ID. Now, I want to give the options like "edit" and "save" below the table, which will update and save the records stored in MySQL database accordingly.
2 Answers
0
with the same mysql_query($query) you just need to run the mysql update:
$query = "UPDATE tablename SET colname = "'.$newvalue.'" WHERE colref = ".$id.""; //$id for example, you can search by any col value.
you can add more updates with commas
SET colname = "'.$newvalue.'", SET colnameb = "'.$newvalueb.'"...
0
And how do I take the new input from the user? should I take the user to a new page after clicking the "edit" button, and have him enter the info? and one more thing, I would like to display the already entered data in the table and have him append the data if he would like to...