I have an update form in my user accounts.
The page is set out in three sections
default
update
modify
When a user clicks on modify the $HTTP_POST_VARS are sent to update in the code.
which is this:
case"Update":
if ($firstname && $lastname && $email) {
$auth=$auth;
$data=$HTTP_POST_VARS;
$auth[login]=$auth[login];
update_member($data, "member");
$content="success.php";
} else {$error="80";}
this is the update_member in another page which is required earlier in the code:
function update_member ($data, $user) {
global $db_name, $tbl_member;
if ($user == "admin") {
$oldpassword = mysql_result(mysql_db_query($db_name, "SELECT password FROM $tbl_member WHERE login='$auth[login]'"),0);
if ($oldpassword == $auth[password]) {$password="";}
else {$password="password='$auth[password]', ";}
else {$password="password='".crypt($auth[password], $auth[login])."', ";}
$active="active='$auth[active]', ";
}
$query = "UPDATE $tbl_member SET $active $password ";
$query.= "firstname='$data[firstname]', lastname='$data[lastname]', email='$data[email]', ";
$query.= "occupation=$data[occupation], organization='$data[organization]', gender='$data[gender]', ";
$query.= "birthdate='$data[tahun]-$data[bulan]-$data[tanggal]', city='$data[city]', ";
$query.= "zipcode='$data[zipcode]', state='$data[state]', country='$data[country]', website='$data[website]', ";
$query.= "phone='$data[phone]', address='$data[address]' ";
$query.= "WHERE login='$auth[login]'";
$hasil=mysql_db_query($db_name, $query) or die (mysql_error());
return $auth[error];
}
When a user clicks on update, the page changes to the success.php, but it doesn't update the database. Why?