//declare variables
$thing = $_SESSION['username']; // get username from session
$name = mysql_real_escape_string($_REQUEST['name']);
$pwrd = mysql_real_escape_string($_RQUEST['pass']);
//$mpwrd= md5($pwrd);
$error = 0;
$select = mysql_query("SELECT * FROM users WHERE username='$username'");
$numrows = mysql_num_rows($select);
$check = mysql_query("SELECT * FROM users WHERE username='$name'");
$check2= mysql_num_rows($check);
//if submitted
if (isset($_POST['submit'])){
if(!$name){
$error ++;
echo "Please fill out all the fields!<br>";
}
/*if($numrows == 0){
$error ++;
echo "Sorry the inputed username does not exist<br>";
}*/
if($check2 !=0){
$error ++;
echo "Sorry the inputed username is already taken!<br>";
}
if ($numrows > 0){
//get user info from db
while ($row = mysql_fetch_assoc($select)){
$dbusername = $row['username'];
$dbpassword = $row['password'];
$id = $row['id'];}
}
if ($pwrd != $dbpassword){
$error ++;
echo "You're password is incorrect<br>";
}
if(!$error){
mysql_query("UPDATE users SET username=$name WHERE username='$thing");
echo "username changed";
}
else
echo 'Your username was not changed due to an error.';
}
// error count on the form.
print "There are currently " . $error ." error(s)";
?>
for some reason it just won't update can anyone point out the error it's probably staring me right in the face but i just don't see it..