title: PHP PDO Change Table Status To Ban User
body: <p>I've successfully after looking at other peoples code made a working login system for my software, I'm not very fluent in PHP or PDO so I would really appreciate some help with my following issue.</p>
  
  <p>This is the whole code:</p>
  
  <pre><code>if ( isset($_GET['username'], $_GET['password'], $_GET['hwid']) ) {
  
  //We use prepared statements, why? Because it's much more safe.
  $userStatement = $connect-&gt;prepare('SELECT * FROM ROE WHERE username = :u AND password = :p');
  //We bind each param, no need to use htmlspecialchars or real_escape_string since PDO will do this for us
  $userStatement-&gt;bindParam(':u', $_GET['username'], PDO::PARAM_STR);
  $userStatement-&gt;bindParam(':p', $_GET['password'], PDO::PARAM_STR);
  //We only continue when the statement is succesfully executed.
  if ( $userStatement-&gt;execute() ) {
      echo $userStatement-&gt;fetchColumn(0) &gt; 0 ? '5352978916' : '0017577757';
  }
  
  //We use prepared statements, why? Because it's much more safe.
  $userStatement1 = $connect-&gt;prepare('SELECT * FROM ROE WHERE hwid = :h');
  //We bind each param, no need to use htmlspecialchars or real_escape_string since PDO will do this for us
  $userStatement1-&gt;bindParam(':h', $_GET['hwid'], PDO::PARAM_STR);
  //We only continue when the statement is succesfully executed.
  if ( $userStatement1-&gt;execute() ) {
      echo $userStatement1-&gt;fetchColumn(0) &gt; 0 ? '&lt;br /&gt;&lt;br /&gt;4201426523' : '&lt;br /&gt;&lt;br /&gt;8940042580' . $userStatement = $connect-&gt;prepare("UPDATE ROE SET status='2' WHERE username=':u'");
  }
  </code></pre>
  
  <p>}</p>
  
  <p>This line of code is what tells me if the user has logged in correctly:</p>
  
  <pre><code>        echo $userStatement1-&gt;fetchColumn(0) &gt; 0 ? '&lt;br /&gt;&lt;br /&gt;4201426523' : '&lt;br /&gt;&lt;br /&gt;8940042580' . $userStatement = $connect-&gt;prepare("UPDATE ROE SET status='2' WHERE username=':u'");
  </code></pre>
  
  <p>When the website displays 4201426523 the field is correct and when the website displays 8940042580 it is incorrect. Now I've tried adding a banning function which will work if the website displays 8940042580 it should change the users 'status' in my phpmyadmin database to 2 however it's not working.</p>
  
  <p>Could someone please help me?</p>
  
  <p>Thanks in advance!</p>