The problem?
I cannot change a users password

All the other functions work fine. I can change a users access level, and email address. When I try to change the password I get a database error. I looked at the code, and that error is programmed into the app. Here is the code to that particular part of the page.
Code: Select all
function update_user_by_admin($new_level, $user_id, $def_pass, $new_email, $active, $confirmation = "no") {
$this->user_found = true;
$this->user_access_level = $new_level;
if ($def_pass != "" && strlen($def_pass) < 4) {
$this->the_msg = "Password is to short use the min. of 4 chars.";
} else {
if ($this->check_email($new_email)) {
$sql = "UPDATE %s SET access_level = %d, email = '%s', active = '%s'";
$sql .= ($def_pass != "") ? sprintf(", SET pw = '%s'", md5($def_pass)) : "";
$sql .= " WHERE id = %d";
$sql_compl = sprintf($sql, $this->table_name, $new_level, $new_email, $active, $user_id);
if (mysql_query($sql_compl)) {
$this->the_msg = "Data is modified for user with id#<b>".$user_id."</b>";
if ($confirmation == "yes") {
if ($this->send_confirmation($user_id)) {
$this->the_msg .= "<br>...a confirmation mail is send to the user.";
} else {
$this->the_msg .= "<br>...ERROR no confirmation mail is send to the user.";
}
}
} else {
$this->the_msg = "Database error, please try again!";
}
} else {
$this->the_msg = "The e-mail address is invalid!";
}
}
}