title: I keep getting "IndexOutOfRangeException" on my Unity project. UNITY + PHP
body: <p>(I was trying to follow this tutorial <a href="https://www.youtube.com/watch?v=NVdjlXgbiMM&amp;t=6s" rel="nofollow noreferrer">https://www.youtube.com/watch?v=NVdjlXgbiMM&amp;t=6s</a>)</p>
  
  <p>I'm trying to implement a login feature in a Unity project, I've successfully done the register part and it works, but I can't get the login part to work.</p>
  
  <p>Every time I try to get info from the database, it gives me the "IndexOutOfRangeException" on C#.
  I think that the problem is in the PHP part tho, since the C# seems to be fine.</p>
  
  <p>C# Code</p>
  
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.UI;
  using UnityEngine.Networking;
  using System.Text.RegularExpressions;
  
  public class login : MonoBehaviour
  {
      public InputField namefield, passwordfield;
      public Button submitButton;
      public GameObject popUp;
      public Text text;
  
      public void CallLogin()
      {
          StartCoroutine(Login2());
      }
  
      IEnumerator Login()
      {
          WWWForm form = new WWWForm();
          form.AddField("name", namefield.text);
          form.AddField("password", passwordfield.text);
          WWW www = new WWW("http://localhost/sqlconnect/login2.php", form);
          yield return www;
  
          Debug.Log(www.text);
  
          if (www.text[0] == '0')
          {
              bddManeger.username = namefield.text;
              bddManeger.tempo = int.Parse(www.text.Split('\t')[1]);
          }
          else
          {
              Debug.Log("User Login Failed. Error #" + www.text);
          }
      }
  
      IEnumerator Login2()
      {
          WWWForm form = new WWWForm();
          form.AddField("name", namefield.text);
          form.AddField("password", passwordfield.text);
          UnityWebRequest www = UnityWebRequest.Post("http://localhost/sqlconnect/login2.php", form);
          yield return www.SendWebRequest();
  
  
          Debug.Log(www.downloadHandler.text);
  
  
          if (www.downloadHandler.text[0] == '0')
          {
              bddManeger.username = namefield.text;
              bddManeger.tempo = int.Parse(www.downloadHandler.text.Split('\t')[1]);
              UnityEngine.SceneManagement.SceneManager.LoadScene(2);
          }
          else
          {
              Debug.Log("User Error: " + www.downloadHandler.text);
          }
      }
  
      private void Update()
      {
          VerifyInputs();
      }
  
      public void VerifyInputs()
      {
          submitButton.interactable = (namefield.text.Length &gt;= 8 &amp;&amp; passwordfield.text.Length &gt;= 8);
  
          if (Input.GetKeyDown(KeyCode.Tab))
          {
              if (namefield.GetComponent&lt;InputField&gt;().isFocused)
              {
                  passwordfield.GetComponent&lt;InputField&gt;().Select();
              }
              if (passwordfield.GetComponent&lt;InputField&gt;().isFocused)
              {
                  namefield.GetComponent&lt;InputField&gt;().Select();
              }
          }
      }
  }
  </code></pre>
  
  <p>PHP</p>
  
  <pre><code>&lt;?php
  
      $con = mysqli_connect('localhost', 'root', 'root', 'apolobdd');
  
      //check connection
      if(mysqli_connect_errno())
      {
          echo "1: falha na conecção";
          exit();
      }
  
      $username = $_POST["name"];
      $password = $_POST["password"];
  
      //check name
      $namecheckquery ="SELECT username, salt, hash, tempo FROM users WHERE username = '" . $usename . "';";
      $namecheck = mysqli_query($con, $namecheckquery) or die ("2: Verificação Falhou");
      if (mysqli_num_rows($namecheck) != 0)
      {
          echo "5: either no user with name or more than one";
          exit();
      }
  
      //get login info from query
      $existinginfo = mysqli_fetch_assot($namecheck);
      $salt = $existinginfo["salt"];
      $hash = $existinginfo["salt"];
  
      $loginhash = crypt($password, $salt);
      if ($hash != $loginhash)
      {
          echo "6: Incorrect Password";
          exit();
      }
  
      echo "0\t" . $existinginfo["tempo"];
  ?&gt;
  </code></pre>