I am doing an update script for a form. When user information is submitted on sign up its submitted to the user db with the following fields, username, pass, full_name and telephone. When the user updates the form to change his/her name for example, the username, pass, tele fields are also a part of the update form. So when a user updates his or her telephone # on the update form, the username info and pass info and the name info are also present on the form. The issue is that the system recognizes that the username is already taken.
So how do i update my script in such a way that the values changed should be picked up by the system. Or is there a better way to do this?
Code:
if (!get_magic_quotes_gpc()) {
$_POST['username'] = addslashes($_POST['username']);
}
$idcheck = $_POST['username'];
$check = mysql_query("SELECT username FROM users WHERE username = '$username'")
or die(mysql_error());
$check2 = mysql_num_rows($check);
if ($check2 != 0) {
print("username already taken");
die('');
}
Basically the issue is that it recognizes that the values already exist but it doesn't realize that its the same users info not some other user using a common id or username...