Can't get echo
Hello, guys. I'm trying to create webGL game with mysql database. I create a simple .php script:
<?php
require "./Libs/rb-mysql.php";
R::setup('mysql:host=localhost;dbname=***',
'***', '***');
if(!R::testConnection()){
echo "Error";
exit();
}
$name = $_REQUEST['Name'];
$user = R::dispense('users');
$user ->name = $name;
R::store($user);
echo "Пользователь $name зарегистрирован!";
?>
and Unity C# code:
private IEnumerator Send()
{
string userName = "Nickname";
WWWForm wf = new WWWForm();
wf.AddField("Name", userName);
WWW www = new WWW("***/index.php", wf);
Debug.Log("PHP3: ");
yield return www;
Debug.Log("PHP4: ");
if (www.error != null)
{
Debug.Log("Error: " + www.error);
}
else {
Debug.Log("Answer:" + www.text);
}
}
The problem is that I can't get any Debug.Log after "PHP3: ", so I don't get "PHP4" and "Answer" or "Error". However, a new user is added to the table if I run my Unity Project. And If I just use link to my index.php in browser, I see the answer and the adding into the table works as well.
Comment
Your answer
Follow this Question
Related Questions
WWW Class silent crach 1 Answer
i need help unity get data from php 0 Answers
WWW class doesn't work well. 1 Answer
run scipt on html webpage 1 Answer
consume a php webservice in Unity3D C# 2 Answers