Hi. I have followed a tutorial on how to use unity with a MYSQL database, and in it it user www, and that is out of date apparently. And I’m very new to this so if anyone could help me to correct my code I woult be very happy. Here is the code that doesn’t work:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Registration : MonoBehaviour
{
public InputField nameField;
public InputField passwordField;
public Button submitButton;
public void CallRegister()
{
StartCoroutine(Register());
}
IEnumerator Register()
{
WWWForm form = new WWWForm();
form.AddField("name", nameField.text);
form.AddField("password", passwordField.text);
WWW www = new WWW("http://localhost/sqlconnect/register.php", form);
yield return www;
if (www.text == "0")
{
Debug.Log("User created successfully.");
UnityEngine.SceneManagement.SceneManager.LoadScene(0);
}
else
{
Debug.Log("User creation faild error #" + www.text);
}
}
public void VerifuInputs()
{
submitButton.interactable = (nameField.text.Length >= 3 && passwordField.text.Length >= 8);
}
}