Jump to content

won't update


ohdang888

Recommended Posts

my code is below...

IN edit_settings.php, i have a form... it has 2 radio buttons per question, a yes and no. the value of Yes is 1, and the value of No is 2.

then this code is on the back end of that form, in change_settings.php

there are no errors, but its not updating it.

 

 

function sql_quote($data) {
  if (get_magic_quotes_gpc()) {
  $data = stripslashes($data);
  }

return addslashes($data);
}

$id = sql_quote($_GET['id']);

if (isset($_POST['submit'])) {

mysql_connect("localhost", "----", "----") or die(mysql_error());
mysql_select_db("members") or die(mysql_error());
$new_age_race = $_POST["age_race"];
$new_contact = $_POST["contact"];
$new_name = $_POST["name"];
$new_non_member = $_POST["non_member"];

$query = "UPDATE `user_settings SET `name` = '{$new_name}' SET `contact` = '{$new_contact}' SET `age_race` = '{$new_age_race}' SET  `non_member` = '{$new_non_member}' WHERE id = '{$id}'";
mysql_query($query);
echo 'done';
}

Link to comment
Share on other sites

"SET" is only specified once. Check the mysql manual for proper syntax. Try this (untested):

 

$query = "UPDATE `user_settings SET `name` = '{$new_name}', `contact` = '{$new_contact}', `age_race` = '{$new_age_race}',  `non_member` = '{$new_non_member}' WHERE id = '{$id}'";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.