Update row in MySQL Database


I want help on updating a row in a database.

I want it so a user can go to this page, see the information already there (got that far) and then make the changes, click submit and then I want it to update this to the database (Haven’t got that far and thats what I want help with).

If anyone can help I will be very happy.

What part do you need help with?

You construct an UPDATE query, a string, by placing the form data in the query. Then execute that query.


$sql = "UPDATE people SET name = '" . mysql_real_escape_string($_POST['name']) . "' WHERE id = " . (int)$_POST['id'];

You should ask this question in the forum for the language you’re using if you need specific help.

Which programming language are you using?