Hi all,
I am trying to get a highscore table showing for my mobile game and while it works fine in the editor it will not download the scores when I export to my android. Can anyone see any issues here:
Is there something I don’t know about doing this on mobile?
public IEnumerator downloadWorldRecordGhost() {
WWW wwwHighscores = new WWW("http://www.mywebsite.com/mygame/GetScore.php");
yield return wwwHighscores;
if (wwwHighscores.error != null)
{
print("There was an error getting the high score: " + wwwHighscores.error);
}
else
{
string[] szSplited = wwwHighscores.text.Split(',');
theID= szSplited[0];
theInteger = int.Parse(szSplited[1]);
TheTime = float.Parse(szSplited[2]);
}
}
and GetScore.php
<?php
$servername = "localhost";
$server_username = "xxxxxxx";
$server_password = "xxxxxxxx";
$dbName = "xxxxxx";
//make connection
$conn = new mysqli($servername, $server_username, $server_password, $dbName);
if(!conn){
die("Connection failed: " . mysqli_connect_error());
}
$query = "SELECT * FROM `Highscores` ORDER by `Score` ASC LIMIT 3";
$result = mysqli_query($conn, $query);
if(mysqli_num_rows($result) > 0){
//show data for each row
while($row = mysqli_fetch_assoc($result)){
echo $row['User'] . ",". $row['SomeValue'] . ",". $row['Score'] . ",";
}
}
?>