Parsing GeoJSON in PHP?

General Tech Bugs & Fixes 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

i am trying to parse GeoJson from database with php but somehow i got an error and i cannot found any error in my script. here my script

$id = 1;
$db = new mysqli("com/tag/localhost">localhost","com/tag/root">root","","skriboo");
$sql = $db->query('SELECT * FROM profil_sekolah WHERE id_sekolah='.$id);
$sql2 = $db->query('SELECT * FROM pegawai WHERE id_pegawai='.$id);
$sql3 = $db->query('SELECT * FROM kelas_x A, kelas_xi B, kelas_xii C WHERE A.id_x=B.id_xi AND B.id_xi=C.id_xii AND C.id_xii='.$id);
$sql4 = $db->query('SELECT * FROM fasilitas WHERE id_sekolah='.$id);
$sql5 = $db->query('SELECT * FROM galeri where id_sekolah='.$id);
$sql6 = $db->query('SELECT bujur, lintang FROM lokasi WHERE id_lokasi='.$id);
$geojson = array(
'type' => 'FeatureCollection',
'features' => array(
    'type' => 'feature',
    'properties' => array(),
    'geometry' => array()
));

while ($row = $sql->fetch_array(MYSQLI_ASSOC)) {
    $properties = $row;
    array_push($geojson['properties'], $properties);
}

while ($row2 = $sql2->fetch_array(MYSQLI_ASSOC)) {
    $properties2 = $row2;
    array_push($geojson['properties'], $properties2);
}

while ($row3 = $sql3->fetch_array(MYSQLI_ASSOC)) {
    $properties3 = $row3;
    array_push($geojson['properties'], $properties3);
}

while ($row4 = $sql4->fetch_array(MYSQLI_ASSOC)) {
    $properties4 = $row4;
    array_push($geojson['properties'], $properties4);
}

while ($row5 = $
                                                
                                                
0 views
0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.