このフォームが送信されたときにフィールド completed_status を 1 更新したい場合、0 のままです。クエリ $submission は、users テーブルの更新です。これは私が使用しているコードです:
$user_id = intval($_SESSION['user_id']);
if (isset($_POST['doPersonal'])) {
if (empty($err)) {
$Sex = mysql_real_escape_string($_POST['Sex']);
$Second_Nationality = mysql_real_escape_string($_POST['Second_Nationality']);
$Birth_Place = mysql_real_escape_string($_POST['Birth_Place']);
$Birth_Country = mysql_real_escape_string($_POST['Birth_Country']);
$children = mysql_real_escape_string($_POST['children']);
$the_query = "INSERT INTO personal (user_id, Sex, Second_Nationality,
Birth_Place, Birth_Country, children)
VALUES ('$user_id', '$Sex', '$Second_Nationality','$Birth_Place', '$Birth_Country',
'$children')
ON DUPLICATE KEY UPDATE Sex=VALUES(Sex), Second_Nationality=VALUES(Second_Nationality),
Birth_Place=VALUES(Birth_Place) , children=VALUES(children)";
// query is ok?
if (mysql_query($the_query, $link) ){
// redirect to user profile
header('Location: myaccount.php?id=' . $user_id);
$submission= "update users set completed_status=completed_status+1 where
id='$_SESSION[user_id]'";
}
}
}
}