title: Update a row mysql in php
body: <p>I have a table that looks like this:</p>
  
  <blockquote>
    <p><strong>name    surname    username         password    role</strong></p>
    
    <p>student   student    student@csd.auth.gr  student         student</p>
    
    <p>student2 student2   student2@csd.auth.gr  student2    student</p>
  </blockquote>
  
  <p>and I want to be able to edit a row in php. 
  The values are taken from a html file like this:</p>
  
  <p><strong>Username</strong>        </p>
  
  <p>student2@csd.auth.gr   <em>&lt;--This will be written in a text box</em></p>
  
  <p><strong>Password</strong>       </p>
  
  <p>student2   <em>&lt;--This will be written in a text box</em></p>
  
  <p><strong>Name</strong>          </p>
  
  <p>student2   <em>&lt;--This will be written in a text box</em>    </p>
  
  <p><strong>Surname</strong>        </p>
  
  <p>student2  <em>&lt;--This will be written in a text box</em></p>
  
  <p><strong>Role</strong>           </p>
  
  <p>student    <em>&lt;--This will be written in a text box</em></p>
  
  <p>My php file is:</p>
  
  <pre><code>&lt;?php
  $hostname = "localhost"; 
  $database = "mydb"; 
  $username = "myuser"; 
  $password = "mypsw";
  $link = mysql_connect( $hostname , $username , $password ) or 
          die("Prosoxi!Provlima stin sundesi me ton server : " . mysql_error());
  mysql_select_db($database,$link);
  
  mysql_query("UPDATE user 
           SET username = '".mysql_real_escape_string($_POST[nusername])."', 
           SET password = '".mysql_real_escape_string($_POST[npassword])."', 
           SET name = '".mysql_real_escape_string($_POST[nname])."', 
           SET surname = '".mysql_real_escape_string($_POST[nsurname])."', 
           SET role = '".mysql_real_escape_string($_POST[nrole])."' 
           WHERE username='".mysql_real_escape_string($_POST[us])."'");
  
  mysql_close($link);
  header("Location: users.php");
  ?&gt;
  </code></pre>
  
  <p>1.The update does not happen, so there's something wrong in the php file, that I can't find.</p>
  
  <p><strong>2. How can I achieve already filled boxes in the html file, with the right values, if I choose a certain username?</strong></p>
  
  <p>Can someone help me? Thank you in advance. :)</p>