0

I have developed a very basic php based webservice to communicate with my android application. This is working fine and I am able to get the data, but when I simultaneously try to access the service from multiple devices or even from browser, only one of them gets the result and other goes on to loading, while the successful one is still able to get the result out of it. Kindly suggest me how can I overcome this problem.

PHP Code :

<?php

$con=mysqli_connect("host","username","pass","DB");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}


$sql="SELECT * FROM ScoreBoard a inner join Groups b ON a.User_ID=b.ID  ORDER By score DESC";




$return_arr = array();

if ($result=mysqli_query($con,$sql))
  {
  // Fetch one and one row
  while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC))
    {
        $rows[] = $row; 
    }
  // Free result set
  mysqli_free_result($result);

}

echo json_encode($rows);
mysqli_close($con);


?>
Mike
  • 23,542
  • 14
  • 76
  • 87
  • Just fixing grammar and code indentation a bit. Remember that with code it needs to be indented by 4 spaces. – Mike Oct 20 '16 at 19:52

1 Answers1

0

It is working fine for me i have tried your code.

kamleshpal
  • 33
  • 8
  • I know Its working. but i am unable to access this concurrently using multiple devices. –  Oct 20 '16 at 17:34