This is my php code below and I need to write some code for editing the user details, I need to write code and I have done create user but don't know how to, do editing,please help me
// Handle user request
$create_user = "INSERT INTO details (username, password, first_name, last_name, gender,email,nationality,ethnicity,address,postcode,tel_number,employment_type,start_of_employment, bio)" .
"VALUES ('{$username}', '{$password}', '{$first_name}', '{$last_name}', '{$gender}','{$email}', '{$nationality}','{$ethnicity}','{$address}','{$postcode}','{$tel_number}','{$employment_type}','{$start_of_employment}','{$bio}');";
You want an UPDATE
statement, something like this:
UPDATE details SET username = "mynewusername", password = "mynewpassword" WHERE detail_id = 5;
You need to use mysql_real_escape_string() to sanitise your input data or you be open to SQL Injection attacks.
Your code would therefore be something like this:
$edit_user = "UPDATE details SET username = '" . mysql_real_escape_string($username) . "', password = '" . mysql_real_escape_string($password) . "' WHERE detail_id = " . mysql_real_escape_string($detail_id) . ";";
You'll need to expand this to include all your fields.
As another side note, you should probably be using the mysqli_* functions instead of the mysql_* functions, as the latter are deprecated and will be removed from PHP soon.