Belajar Marker PHP

Legit…

PututNet

oiseng2 belajar SIG dengan marker buat killing time, sebelum kita buat skripnya kita buat dulu databasenya gan

buat database lokasi dengan tabel lokasi juga

buat file dataLokasi.php untuk memanggil databasenya //=============================================================================

<?php

// Parsing Karakter-Karakter Khusus
function parseToXML($htmlStr)
{
$xmlStr=str_replace(‘<‘,'<‘,$htmlStr);
$xmlStr=str_replace(‘>’,’>’,$xmlStr);
$xmlStr=str_replace(‘”‘,'”‘,$xmlStr);
$xmlStr=str_replace(“‘”,”‘”,$xmlStr);
$xmlStr=str_replace(“&”,’&’,$xmlStr);
return $xmlStr;
}

// Menghubungkan Koneksi dengan server MySQL, ganti bagian $username, $password, dan $database.
$username=”root”;
$password=””;
$database=”markers2″;

$connection=mysql_connect (localhost, $username, $password);
if (!$connection) {
die(‘Not connected : ‘ . mysql_error());
}

// Memilih database MySQL yang aktif
$db_selected = mysql_select_db($database, $connection);
if (!$db_selected) {
die (‘Can\’t use db : ‘ . mysql_error());
}

// Memilih semua baris pada tabel ‘markers2’
$query = “SELECT * FROM markers2”;
$result = mysql_query($query);
if (!$result) {
die(‘Invalid query: ‘ . mysql_error());
}

// Header File XML
header(“Content-type: text/xml”);

// Parent node XML
echo ‘<markers>’;

// Iterasi baris, masing-masing menghasilkan node-node XML
while ($row = @mysql_fetch_assoc($result)){

// Menambahkan ke node…

View original post 318 more words

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s