title: $query = sprintf not updating MySQL database
body: <p>I'm trying to create a forgot password script, however i'm getting caught up slightly.  </p>
  
  <p>The issue is, <code>$query = sprintf("UPDATE</code>users<code>SET</code>password<code>= '%s' 
                        WHERE</code>email<code>= '$forgotpassword'",
                  mysql_real_escape_string($newpassword));</code> is not updating the data in the field 'password'.</p>
  
  <p>The 'forgot' value is updating as needed. And again, I know the script is connecting to the database as the forgot field is updating to '1' as needed.</p>
  
  <p>Heres the code:</p>
  
  <pre><code>//Generate a RANDOM MD5 Hash for a password
  $random_password=md5(uniqid(rand()));
  
  //Take the first 8 digits and use them as the password we intend to email the user
  $emailpassword=substr($random_password, 0, 8);
  
  //Encrypt MD5 format for the database
  $newpassword = md5($emailpassword);
  
      // Make a safe query
      $query = sprintf("UPDATE `users` SET `password` = '%s' 
                        WHERE `email` = '$forgotpassword'",
                  mysql_real_escape_string($newpassword));
  
      $query = sprintf("UPDATE `users` SET `forgot` = '1' 
                        WHERE `email` = '$forgotpassword'");
  
                  mysql_query($query)or die('Could not update members: ' . mysql_error());
  </code></pre>
  
  <p>I know this version of MYSQL is depreciated, but it's what this project has to use. Just got to go with me on that one.</p>
  
  <p>Cheers</p>