`$sql = "call geodist(".$_SESSION['This'].",500)";` //get the ids near you
$result=mysqli_query($GLOBALS['link'],$sql) or die(mysqli_error($GLOBALS['link']));
while($row=mysqli_fetch_assoc($result)) // insert them into nerby table
{
$sql = "INSERT INTO `nearby`(`userid`, `strangerid`) VALUES (".$_SESSION['This'].",".$row['id'].")";
mysqli_close($GLOBALS['link']);
mysqli_query($GLOBALS['link'],$sql)
or die("akash".mysqli_error($GLOBALS['link']));
}
when i remove the '//*' statements i get out of sync error.... keeping those two lines help me run my code but code becomes slow since for every loop iteration the database connection is closed and reopened. pls tel me an alternate.... i will really be grateful to you