title: Database Error HY000
body: <p>My code working fine , but i got this error : <br/></p>
  
  <blockquote>
    <p>SQLSTATE[HY000]: General error</p>
  </blockquote>
  
  <p>I searching on google and someone say that it's may SQLi <br/>
  What is this ? And how can i fix that ? <br/>
  thanks and sorry for my poor english</p>
  
  <pre><code>    try{
          $db_con = new PDO("mysql:host={$db_host};dbname={$db_name}",$db_user,$db_pass);
          $db_con-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
          // Anti Brute Forced
          $stmt = $db_con-&gt;prepare("
              SELECT * FROM users
          ");
          $stmt-&gt;execute();
          while ($row = $stmt-&gt;fetch(PDO::FETCH_ASSOC)){
              $users_username = $row["users_username"];
              $users_password = $row["users_password"];
              $users_wrong_password = $row["users_wrong_password"];
              if ($users_wrong_password &lt;= 3 &amp;&amp; isset($_GET["username"],$_GET["password"]) &amp;&amp; $_GET["username"] == $users_username &amp;&amp; $_GET["password"] != $users_password){
                  $u = $users_wrong_password + 1;
                  $g = 0;
                  $g = $_GET['username'];
                  $stmt = $db_con-&gt;prepare("
                      UPDATE users
                      SET users_wrong_password = $u
                      WHERE users.users_username = '$g'
                  ");
                  $stmt-&gt;execute();
              }
              if ($_GET["username"] == $users_username &amp;&amp; $users_wrong_password &gt;= 4){
                  echo "Your Account Was Banned For 1 Hours";
                  die;
              }
          }
          $g = $_GET['username'];
          $stmt = $db_con-&gt;prepare("SELECT * FROM users where users_username = '$g'");
          $stmt-&gt;execute();
          while ($row = $stmt-&gt;fetch(PDO::FETCH_ASSOC)){
              $ss = $row["users_wrong_password"];
          }
          if($ss &lt;= 3){
              $g = 0;
              $g = $_GET['username'];
              $stmt = $db_con-&gt;prepare("
                  UPDATE users
                  SET users_wrong_password = 0
                  WHERE users_username = '{$_GET['username']}'
              ");
              $stmt-&gt;execute();
          }
          // Anti Brute Forced
  </code></pre>
  
  <p>[Solved]
  Edit:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>  $g = $_GET['username'];
    $p = $_GET['password'];
    $stmt = $db_con-&gt;prepare("
     SELECT * FROM users where users_username = '$g' and users_password = '$p'
    ");</code></pre>
  </div>
  </div>
  </p>