title: c# login using xampp and php in UNITY
body: <p>Hello everyone so i was developing a game with login in Unity 5, I successfully manage to create a registration form but the login always keeps saying "login failed" even though the username and password are correct. I feel like my code only recognize the "else" statement because I already tried switching my conditions</p>
  
  <p>here is the C# code</p>
  
  <pre><code>using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.UI;
  using UnityEngine.SceneManagement;
  
  public class DataLogin : MonoBehaviour {
  public InputField inputUsername1;
  public InputField inputPassword1;
  public static string Username;
  public static string Password;
  
  
  string UserURL1 = "http://localhost/login.php";
  
  void Start(){
  
  }
  void Update(){
  
  }
  //  void OnMouseDown(Button insertButton){
  //      InsertData(inputUsername, inputPassword);
  //  }
  public void Button_Click1(){
      StartCoroutine(LoginData (inputUsername1, inputPassword1));
  
  }
  IEnumerator LoginData(InputField inputUsername1, InputField inputPassword1){
      WWWForm form = new WWWForm ();
      form.AddField ("username", inputUsername1.text);
      form.AddField ("password", inputPassword1.text);
  
      WWW www = new WWW (UserURL1, form);
      yield return www;
  
      if (www.text [0] == '0') {
          Debug.Log ("User Login Success.");
      } else {
          Debug.Log ("User Login Failed.");
     }
    }
  }
  </code></pre>
  
  <p>here is the php code</p>
  
  <pre><code>&lt;?php
      $servername = "localhost";
      $username = "root";
      $password = "";
      $dbname = "table_test";
  
      $user = $_POST["username"];
      $pass = $_POST["password"];
  
       // Create connection
      $conn = mysqli_connect($servername, $username, $password, $dbname);
      // Check connection
      if (!$conn) {
        die("Connection failed: " . mysqli_connect_error());
      }
  
      $sql = " SELECT * FROM test WHERE username = '$user' AND password = '$pass'";
      $result = mysqli_query($conn, $sql);
      if ($result-&gt;num_rows &gt; 0) {
        while ($row = $result-&gt;fetch_assoc()) {
          if ($row['username'] = $user &amp;&amp; $row['password'] = $pass) {
            echo ("Login Successfully");
          } else {
            echo ("Login Failed");
          }
       }
     }
  ?&gt;
  </code></pre>