So I'm trying to make a simple login system in Unity using C#, PHP and MySQL on localhost, but there is a problem. My code works like this:
In the php file, if the username and password matches the ones in the MySQL database, then echo 1. Else echo 0.
In the C# script file in Unity, the problem is in this part of the code:
if (www.error == null)
{
if (www.data == "1")
{
Debug.Log("Successful login/nLoading Scene...");
StartCoroutine(GoToMenu());
}
else
{
Debug.Log("Invalid account or password");
print(www.url);
print(www.data);
}
}
The problem is that my www.data is returning 1, but it's skipping the condition www.data == "1" and going to else, where it print it's URL (I checked it, it's correct and functional) and it's data (equal to 1).