I am at a loss here. I have followed the instructions to a “T”, but yet I get nothing back in error or text on the return of the $result variable from PHP. Both error and text are “”. The status returns as OK 200. I have checked the values passed and they are correct, and when I run the query in the browser with the SQL I echo back, it returns 1 row, so I know it is valid.
public void queryUser(string username, string password)
{
string url = “http://…/phpDBScripts/getUser.php?username=” + username + “&password=” + password;
WWW www = new WWW(url);
StartCoroutine(WaitForRequest(www));
}
public IEnumerator WaitForRequest(WWW www)
{
yield return www;
//check for errors
if (www.error == “”)
{
Debug.Log("WWW returned OK! Data: " + www.text);![]()
}
else
{
Debug.Log("WWW Error: " + www.error);![]()
}
}
and my php code:
<?php //Create connection $conn = mysqli_connect($servername, $dbUsername, $dbPassword, $database); //Check Connection if(!$conn) { die("Connection failed: " .mysqli_connect_error()); } //echo "Connected Successfully!"; $username = db_quote($_GET['username'], $conn); $password = db_quote($_GET['password'], $conn); $sql ="SELECT * FROM accounts WHERE username=" . $username . " AND password=" . $password; $result = mysqli_query($conn, $sql); if($result) { return $result; }else { echo "Error: " . $sql . " " . mysqli_error($conn); } mysqli_close($conn); function db_quote($value, $conn) { return "'" . mysqli_real_escape_string($conn,$value) . "'"; } ?>What am I doing wrong?
Also sometimes I get an error in unity talking about a Fatal Error with Asset Bundle ‘Memory’?? I’m not doing anything with an assetbunde at all…
Why is the result not returning anything?