title: can't get result from sql database
body: <p>I am very new to php and I am trying to create a login system. Here is my code</p>
  
  <pre><code>&lt;?php
  
      $con=mysqli_connect("XXXXXXX","XXXXXXXX","XXXXXXXXX","XXXXXXXXXX");
  
      if (!$con)
          {
          echo "failed to connect";
          }
  
      $username = $_POST['username'];
      $password = $_POST['password'];
  
      $sql = "SELECT userID FROM users WHERE username = $username and password =          $password;";
  
      if (!$sql) {
          echo 'query invalid'.mysql_error();
          }
  
      $result = mysql_query($sql);
  
      echo "$result";
  
      $row = mysqli_fetch_array($sql, MYSQLI_ASSOC);
  
      $active = $row['active'];
  
      $count = mysqli_num_rows($result);
  
      mysql_close($con);
  
  ?&gt;
  </code></pre>
  
  <p>I am sure there is no problem with the connection. But my result is not showing up and there is no error message. Previously I had an IF statement that perform further action if the result comes back. Since I am trying to figure out what is going on, I just deleted that part. Somebody please help. Many thanks</p>