Code: Select all
function Awake () {
getname();
}
function getname()
{
var formText = new Array(); //this field is where the messages sent by PHP script will be in
var inctext;
var URL = "http://localhost/driftwurld/zzzgetdbdata.php"; //change for your URL
var w = WWW(URL); //here we create a var called 'w' and we sync with our URL and the form
yield w; //we wait for the form to check the PHP file, so our game dont just hang
if (w.error != null) {
print(w.error); //if there is an error, tell us
} else {
inctext = w.text;
formText = inctext.Split(":"[0]);
////////////create variables from DB
GameObject.Find ("Headsup").guiText.text=""+formText[0];
//Debug.Log(formText);
w.Dispose(); //clear our form in game
}
}