/ Opens a connection to a MySQL server.
$connection = mysqli_connect($server, $username, $password, $database);
mysqli_set_charset($connection, 'UTF8');
/* проверка соединения */
if (mysqli_connect_errno()) {
printf("Не удалось подключиться: %s\n", mysqli_connect_error());
exit();
}
$query1 = "SELECT storagepoints.StorageName, storagepoints.Latitude,storagepoints.Longitude FROM storagepoints WHERE 1;";
$query2 = "SELECT kwsKomi.id AS id FROM kwsKomi WHERE (CONTAINS(kwsKomi.points, geometryfromtext('Point($a $b)')) = 1);";
$query1 = mysqli_query($connection, $query1);
$query2 = mysqli_query($connection, $query2);
while ($row = mysqli_fetch_assoc($query1)) {
echo $a = $row['Latitude'];
echo $b = $row['Longitude'];
echo "------------------------";
while ( $row2 = mysqli_fetch_assoc($query2)) {
echo $row2;
}
//ограничим вывод одной итерацией
break;
}
$query1 = "SELECT storagepoints.StorageName, storagepoints.Latitude,storagepoints.Longitude FROM storagepoints WHERE 1;";
$query1 = mysqli_query($connection, $query1);
$i=0;
while ($row = mysqli_fetch_assoc($query1)) {
$a = $row['Latitude'];
$b = $row['Longitude'];
$c = strval("geometryfromtext('Point(".$a." ".$b.")')");
echo $c;
//
// echo "------------------------";
$rows = mysqli_num_rows($query2);
//if ($query2) {
$query2 = "SELECT polygoneskwsKomi.id AS id FROM polygoneskwsKomi WHERE (CONTAINS(polygoneskwsKomi.points, $c) = 1);";
$query2 = mysqli_query($connection, $query2);
$row2 = mysqli_fetch_assoc($query2);
echo (" - ".$row2['id']."</br>");
/ Opens a connection to a MySQL server.
$connection = mysqli_connect($server, $username, $password, $database);
mysqli_set_charset($connection, 'UTF8');
/* проверка соединения */
if (mysqli_connect_errno()) {
printf("Не удалось подключиться: %s\n", mysqli_connect_error());
exit();
}
$query1 = "SELECT storagepoints.StorageName, storagepoints.Latitude,storagepoints.Longitude FROM storagepoints WHERE 1;";
$query1 = mysqli_query($connection, $query1);
while ($row = mysqli_fetch_assoc($query1)) {
echo $a = $row['Latitude'];
echo $b = $row['Longitude'];
echo "------------------------";
/* второй запрос */
$query2 = "SELECT kwsKomi.id AS id FROM kwsKomi WHERE (CONTAINS(kwsKomi.points, geometryfromtext('Point($a $b)')) = 1);";
$query2 = mysqli_query($connection, $query2);
/* конец второго запроса */
while ( $row2 = mysqli_fetch_assoc($query2)) {
echo $row2;
}
//ограничим вывод одной итерацией
break;
}