<?php
require_once"config.php";
echo"<hr>";
cekKolom($conn,"baksos");
echo"<hr>";
$sql='select * from tb_admin';
//$result=$conn->query($sql);
$result = mysqli_query($conn,$sql);
$jc=mysqli_num_fields($result);
echo "Ada sebanyak: ".$jc." Kolom";
echo"<hr>";
while ($fieldinfo=mysqli_fetch_field($result)){
printf("Name: %s\n",$fieldinfo->name);
printf("Table: %s\n",$fieldinfo->type);
echo"<hr>";
}
$colObj = mysqli_fetch_field_direct($result,1);
$col = $colObj->name;
echo "<br/>Kolemm ke-1: ".$col;
mysqli_free_result($result);
$conn -> close();
function cekKolom($conn,$NK){
$ada=0;
$sql = "SELECT * from tb_admin";
if ($result = $conn -> query($sql)) {
while ($fieldinfo = $result -> fetch_field()) {
if($NK==$fieldinfo -> name){$ada++;}
}
$result -> free_result();
}
if($ada==0){
$sql="ALTER TABLE `tb_admin` ADD `".$NK."` VARCHAR(30) NOT NULL ";
process($conn,$sql);
}
return $ada;
}
?>
Jumat, 20 Desember 2019
Selasa, 17 Desember 2019
MULTI Marker PHP dan Direction Revisi
<?php
$setjarak=100;
if(isset($_POST["Set"])){
$setjarak=$_POST["jarak"];
}
//AIzaSyBhSg6I2JvHNU_jLqIpvc5MEwc_xi3Ttvg
//AIzaSyCbkraMfyHLJxgO0XMLEWxz6xlLRmQpwYM
?>
<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?key=AIzaSyBhSg6I2JvHNU_jLqIpvc5MEwc_xi3Ttvg"></script>
<script>
var map;
Number.prototype.toRad = function() {
return this * Math.PI / 180;
}
function initialize() {
<?php
$lat0= -6.217003;
$lon0=106.828432;
?>
var lat1=<?php echo $lat0;?>;
var lon1=<?php echo $lon0;?>;
var myLatlng = new google.maps.LatLng(lat1, lon1);
var mapOptions = {
zoom: 10,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
var image = 'https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png';
var location0 = new google.maps.LatLng(lat1,lon1);
var marker0 = new google.maps.Marker({
position: location0,
map: map,
icon: image
});
marker0.setTitle("Posisi Anda");
var content0="Kampus STIE Perbanas";
attachSecretMessage(marker0, content0);
// or: new Array();
var arLat= [];
var arLon= [];
var arNama= [];
var arLok= [];
var arJarak= [];
var n=0;
var JM=200000000;
<?php
$sql="select * from `$tbpb`";// where status='Diterima'
$arr=getData($conn,$sql);
$j=0;
if(isset($_POST["Set"])){ ?>
JM= <?php echo $_POST["jarak"];?>
<?php
}
else{
?>
var JM=200000000;
<?php
}
foreach($arr as $d) {
$id_pb=$d["id_pb"];
$id_customer=getCustomer($conn,$d["id_customer"]);
$jam=$d["jam"];
$lat=$d["latitude"];
$long=$d["longitude"];
$status=$d["status"];
$alamat=$d["alamat"];
$gambar=$d["gambar"];
$pesan=$d["pesan"];
$nopol=$d["nopol"];
$jenis_mobil=$d["jenis_mobil"];
?>
var lat2= <?php echo $lat;?>;
var lon2= <?php echo $long;?>;
var R = 6371; // km
//has a problem with the .toRad() method below.
var x1 = lat2-lat1;
var dLat = x1.toRad();
var x2 = lon2-lon1;
var dLon = x2.toRad();
var a = Math.sin(dLat/2) * Math.sin(dLat/2) +
Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) *
Math.sin(dLon/2) * Math.sin(dLon/2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
var d = R * c;
<?php if(isset($_POST["Set"])){ ?>
if(d <= JM){
arLat[n]= <?php echo $lat;?>;
arLon[n]= <?php echo $long;?>;
arNama[n]= "<?php echo $id_customer;?>";
arLok[n]= "<?php echo "Hasil cari <=".$_POST["jarak"]." KM : $id_customer #<a href='direction.php?mnu=direction&lat=$lat0&lon=$lon0&id=$id_pb&origin=$id_customer' target='_blank'>Go Direction</a>";?>;"
arJarak[n]=d;
n=n+1;
}//<=
<?php
}//isset
else{
?>
arLat[n]= <?php echo $lat;?>;
arLon[n]= <?php echo $long;?>;
arNama[n]="<?php echo $id_customer;?>";
arLok[n]= "<?php echo "$id_customer #<a href='direction.php?mnu=direction&lat=$lat0&lon=$lon0&id=$id_pb&origin=$id_customer' target='_blank'>Go Direction</a>";?>";
arJarak[n]=d;
n=n+1;
<?php
}//else
}//foreach
?>
for (var i = 0; i < n; i++) {
var location = new google.maps.LatLng(arLat[i],arLon[i]);
var marker = new google.maps.Marker({
position: location,
map: map
});
marker.setTitle(arNama[i]);
var content=arNama[i]+"\n"+arLok[i]+" jarak :"+arJarak[i]+" KM";
attachSecretMessage(marker, content);
}
}
function attachSecretMessage(marker, lokasi) {
var infowindow = new google.maps.InfoWindow({content: lokasi,size: new google.maps.Size(50,50)});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<body>
<div id="map_canvas" style="width:100%;height:500px;"></div>
<br>
<div align="right">
<form action="" method="post">
Set jarak Minimal <input type="text" name="jarak" id="jarak" value="<?php echo $setjarak;?>">
<input type="submit" value="Set" name="Set">
</form>
</div>
</body>
++++
<?php
require_once"konmysqli.php";
$id=100;
$id_pb="PNB1912004";
$lat0= -6.217003;
$lon0=106.828432;
$origin="Kampus STIE Perbanas";
if(isset($_GET["id"])){
$id_pb=$_GET["id"];
$lat0=$_GET["lat"];
$lon0=$_GET["lon"];
$origin=$_GET["origin"];
}
$sql="select * from `$tbpb` where `id_pb`='$id_pb' ";
$d=getField($conn,$sql);
$id_pb=$d["id_pb"];
$id_customer="";//getCustomer($conn,$d["id_customer"]);
$jam=$d["jam"];
$latitude=$d["latitude"];
$longitude=$d["longitude"];
$status=$d["status"];
$alamat=$d["alamat"];
$keterangan=$d["keterangan"];
$gambar=$d["gambar"];
$gambar0=$d["gambar"];
$pesan=$d["pesan"];
$nopol=$d["nopol"];
$jenis_mobil=$d["jenis_mobil"];
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Travel Modes in Directions</title>
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#floating-panel {
position: absolute;
top: 10px;
left: 25%;
z-index: 5;
background-color: #fff;
padding: 5px;
border: 1px solid #999;
text-align: center;
font-family: 'Roboto','sans-serif';
line-height: 30px;
padding-left: 10px;
}
</style>
</head>
<body>
<div id="floating-panel">
<b>Mode of Travel: </b>
<select id="mode">
<option value="DRIVING">Driving</option>
<option value="WALKING">Walking</option>
<option value="BICYCLING">Bicycling</option>
<option value="TRANSIT">Transit</option>
</select>
</div>
<div id="map"></div>
<script>
function initMap() {
var directionsRenderer = new google.maps.DirectionsRenderer;
var directionsService = new google.maps.DirectionsService;
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 14,
center: {lat: <?php echo $lat0;?>, lng: <?php echo $lon0;?>}
});
directionsRenderer.setMap(map);
calculateAndDisplayRoute(directionsService, directionsRenderer);
document.getElementById('mode').addEventListener('change', function() {
calculateAndDisplayRoute(directionsService, directionsRenderer);
});
}
function calculateAndDisplayRoute(directionsService, directionsRenderer) {
var selectedMode = document.getElementById('mode').value;
directionsService.route({
origin: {lat: <?php echo $lat0;?>, lng: <?php echo $lon0;?>}, // Haight.
destination: {lat: <?php echo $latitude;?>, lng: <?php echo $longitude;?>}, // Ocean Beach.
// Note that Javascript allows us to access the constant
// using square brackets and a string value as its
// "property."
travelMode: google.maps.TravelMode[selectedMode]
}, function(response, status) {
if (status == 'OK') {
directionsRenderer.setDirections(response);
} else {
window.alert('Directions request failed due to ' + status);
}
});
}
google.maps.event.addDomListener(window, 'load', initMap);
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBhSg6I2JvHNU_jLqIpvc5MEwc_xi3Ttvg&callback=initMap">
</script>
</body>
</html>
<?php
function process($conn,$sql){
$s=false;
$conn->autocommit(FALSE);
try {
$rs = $conn->query($sql);
if($rs){
$conn->commit();
$last_inserted_id = $conn->insert_id;
$affected_rows = $conn->affected_rows;
$s=true;
}
}
catch (Exception $e) {
echo 'fail: ' . $e->getMessage();
$conn->rollback();
}
$conn->autocommit(TRUE);
return $s;
}
function getJum($conn,$sql){
$rs=$conn->query($sql);
$jum= $rs->num_rows;
$rs->free();
return $jum;
}
function getField($conn,$sql){
$rs=$conn->query($sql);
$rs->data_seek(0);
$d= $rs->fetch_assoc();
$rs->free();
return $d;
}
function getData($conn,$sql){
$rs=$conn->query($sql);
$rs->data_seek(0);
$arr = $rs->fetch_all(MYSQLI_ASSOC);
//foreach($arr as $row) {
// echo $row['nama_kelas'] . '*<br>';
//}
$rs->free();
return $arr;
}
?>
$setjarak=100;
if(isset($_POST["Set"])){
$setjarak=$_POST["jarak"];
}
//AIzaSyBhSg6I2JvHNU_jLqIpvc5MEwc_xi3Ttvg
//AIzaSyCbkraMfyHLJxgO0XMLEWxz6xlLRmQpwYM
?>
<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?key=AIzaSyBhSg6I2JvHNU_jLqIpvc5MEwc_xi3Ttvg"></script>
<script>
var map;
Number.prototype.toRad = function() {
return this * Math.PI / 180;
}
function initialize() {
<?php
$lat0= -6.217003;
$lon0=106.828432;
?>
var lat1=<?php echo $lat0;?>;
var lon1=<?php echo $lon0;?>;
var myLatlng = new google.maps.LatLng(lat1, lon1);
var mapOptions = {
zoom: 10,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
var image = 'https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png';
var location0 = new google.maps.LatLng(lat1,lon1);
var marker0 = new google.maps.Marker({
position: location0,
map: map,
icon: image
});
marker0.setTitle("Posisi Anda");
var content0="Kampus STIE Perbanas";
attachSecretMessage(marker0, content0);
// or: new Array();
var arLat= [];
var arLon= [];
var arNama= [];
var arLok= [];
var arJarak= [];
var n=0;
var JM=200000000;
<?php
$sql="select * from `$tbpb`";// where status='Diterima'
$arr=getData($conn,$sql);
$j=0;
if(isset($_POST["Set"])){ ?>
JM= <?php echo $_POST["jarak"];?>
<?php
}
else{
?>
var JM=200000000;
<?php
}
foreach($arr as $d) {
$id_pb=$d["id_pb"];
$id_customer=getCustomer($conn,$d["id_customer"]);
$jam=$d["jam"];
$lat=$d["latitude"];
$long=$d["longitude"];
$status=$d["status"];
$alamat=$d["alamat"];
$gambar=$d["gambar"];
$pesan=$d["pesan"];
$nopol=$d["nopol"];
$jenis_mobil=$d["jenis_mobil"];
?>
var lat2= <?php echo $lat;?>;
var lon2= <?php echo $long;?>;
var R = 6371; // km
//has a problem with the .toRad() method below.
var x1 = lat2-lat1;
var dLat = x1.toRad();
var x2 = lon2-lon1;
var dLon = x2.toRad();
var a = Math.sin(dLat/2) * Math.sin(dLat/2) +
Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) *
Math.sin(dLon/2) * Math.sin(dLon/2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
var d = R * c;
<?php if(isset($_POST["Set"])){ ?>
if(d <= JM){
arLat[n]= <?php echo $lat;?>;
arLon[n]= <?php echo $long;?>;
arNama[n]= "<?php echo $id_customer;?>";
arLok[n]= "<?php echo "Hasil cari <=".$_POST["jarak"]." KM : $id_customer #<a href='direction.php?mnu=direction&lat=$lat0&lon=$lon0&id=$id_pb&origin=$id_customer' target='_blank'>Go Direction</a>";?>;"
arJarak[n]=d;
n=n+1;
}//<=
<?php
}//isset
else{
?>
arLat[n]= <?php echo $lat;?>;
arLon[n]= <?php echo $long;?>;
arNama[n]="<?php echo $id_customer;?>";
arLok[n]= "<?php echo "$id_customer #<a href='direction.php?mnu=direction&lat=$lat0&lon=$lon0&id=$id_pb&origin=$id_customer' target='_blank'>Go Direction</a>";?>";
arJarak[n]=d;
n=n+1;
<?php
}//else
}//foreach
?>
for (var i = 0; i < n; i++) {
var location = new google.maps.LatLng(arLat[i],arLon[i]);
var marker = new google.maps.Marker({
position: location,
map: map
});
marker.setTitle(arNama[i]);
var content=arNama[i]+"\n"+arLok[i]+" jarak :"+arJarak[i]+" KM";
attachSecretMessage(marker, content);
}
}
function attachSecretMessage(marker, lokasi) {
var infowindow = new google.maps.InfoWindow({content: lokasi,size: new google.maps.Size(50,50)});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<body>
<div id="map_canvas" style="width:100%;height:500px;"></div>
<br>
<div align="right">
<form action="" method="post">
Set jarak Minimal <input type="text" name="jarak" id="jarak" value="<?php echo $setjarak;?>">
<input type="submit" value="Set" name="Set">
</form>
</div>
</body>
++++
<?php
require_once"konmysqli.php";
$id=100;
$id_pb="PNB1912004";
$lat0= -6.217003;
$lon0=106.828432;
$origin="Kampus STIE Perbanas";
if(isset($_GET["id"])){
$id_pb=$_GET["id"];
$lat0=$_GET["lat"];
$lon0=$_GET["lon"];
$origin=$_GET["origin"];
}
$sql="select * from `$tbpb` where `id_pb`='$id_pb' ";
$d=getField($conn,$sql);
$id_pb=$d["id_pb"];
$id_customer="";//getCustomer($conn,$d["id_customer"]);
$jam=$d["jam"];
$latitude=$d["latitude"];
$longitude=$d["longitude"];
$status=$d["status"];
$alamat=$d["alamat"];
$keterangan=$d["keterangan"];
$gambar=$d["gambar"];
$gambar0=$d["gambar"];
$pesan=$d["pesan"];
$nopol=$d["nopol"];
$jenis_mobil=$d["jenis_mobil"];
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Travel Modes in Directions</title>
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#floating-panel {
position: absolute;
top: 10px;
left: 25%;
z-index: 5;
background-color: #fff;
padding: 5px;
border: 1px solid #999;
text-align: center;
font-family: 'Roboto','sans-serif';
line-height: 30px;
padding-left: 10px;
}
</style>
</head>
<body>
<div id="floating-panel">
<b>Mode of Travel: </b>
<select id="mode">
<option value="DRIVING">Driving</option>
<option value="WALKING">Walking</option>
<option value="BICYCLING">Bicycling</option>
<option value="TRANSIT">Transit</option>
</select>
</div>
<div id="map"></div>
<script>
function initMap() {
var directionsRenderer = new google.maps.DirectionsRenderer;
var directionsService = new google.maps.DirectionsService;
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 14,
center: {lat: <?php echo $lat0;?>, lng: <?php echo $lon0;?>}
});
directionsRenderer.setMap(map);
calculateAndDisplayRoute(directionsService, directionsRenderer);
document.getElementById('mode').addEventListener('change', function() {
calculateAndDisplayRoute(directionsService, directionsRenderer);
});
}
function calculateAndDisplayRoute(directionsService, directionsRenderer) {
var selectedMode = document.getElementById('mode').value;
directionsService.route({
origin: {lat: <?php echo $lat0;?>, lng: <?php echo $lon0;?>}, // Haight.
destination: {lat: <?php echo $latitude;?>, lng: <?php echo $longitude;?>}, // Ocean Beach.
// Note that Javascript allows us to access the constant
// using square brackets and a string value as its
// "property."
travelMode: google.maps.TravelMode[selectedMode]
}, function(response, status) {
if (status == 'OK') {
directionsRenderer.setDirections(response);
} else {
window.alert('Directions request failed due to ' + status);
}
});
}
google.maps.event.addDomListener(window, 'load', initMap);
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBhSg6I2JvHNU_jLqIpvc5MEwc_xi3Ttvg&callback=initMap">
</script>
</body>
</html>
<?php
function process($conn,$sql){
$s=false;
$conn->autocommit(FALSE);
try {
$rs = $conn->query($sql);
if($rs){
$conn->commit();
$last_inserted_id = $conn->insert_id;
$affected_rows = $conn->affected_rows;
$s=true;
}
}
catch (Exception $e) {
echo 'fail: ' . $e->getMessage();
$conn->rollback();
}
$conn->autocommit(TRUE);
return $s;
}
function getJum($conn,$sql){
$rs=$conn->query($sql);
$jum= $rs->num_rows;
$rs->free();
return $jum;
}
function getField($conn,$sql){
$rs=$conn->query($sql);
$rs->data_seek(0);
$d= $rs->fetch_assoc();
$rs->free();
return $d;
}
function getData($conn,$sql){
$rs=$conn->query($sql);
$rs->data_seek(0);
$arr = $rs->fetch_all(MYSQLI_ASSOC);
//foreach($arr as $row) {
// echo $row['nama_kelas'] . '*<br>';
//}
$rs->free();
return $arr;
}
?>
Kamis, 12 Desember 2019
PHP MAP MULTI MARKER DAN DIRECTION
Generate dahulu apikey:
https://console.cloud.google.com/apis/credentials/key/80ecde3a-5abc-4c54-af65-45d6446701a9?project=trusty-gradient-251202
Buat Kode sbb:
<?php
require_once"konmysqli.php";
$setjarak=100;
if(isset($_POST["Set"])){
$setjarak=$_POST["jarak"];
}
//AIzaSyBhSg6I2JvHNU_jLqIpvc5MEwc_xi3Ttvg
//AIzaSyCbkraMfyHLJxgO0XMLEWxz6xlLRmQpwYM
?>
<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?key=AIzaSyBhSg6I2JvHNU_jLqIpvc5MEwc_xi3Ttvg&sensor=true"></script>
<script>
var map;
Number.prototype.toRad = function() {
return this * Math.PI / 180;
}
function initialize() {
var lat1=-6.353019;
var lon1=106.833086;
var myLatlng = new google.maps.LatLng(lat1, lon1);
var mapOptions = {
zoom: 10,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
var image = 'https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png';
var location0 = new google.maps.LatLng(lat1,lon1);
var marker0 = new google.maps.Marker({
position: location0,
map: map,
icon: image
});
marker0.setTitle("Posisi Anda");
var content0="Jl. RS Fatmawati, Pangkalan Jati, Cilandak, Kota Jakarta Selatan, Daerah Khusus Ibukota Jakarta 16514";
attachSecretMessage(marker0, content0);
// or: new Array();
var arLat= [];
var arLon= [];
var arNama= [];
var arLok= [];
var arJarak= [];
var n=0;
var JM=200000;
<?php
$sql="select * from `tb_restoran`";
$arr=getData($conn,$sql);
$j=0;
if(isset($_POST["Set"])){ ?>
JM= <?php echo $_POST["jarak"];?>
<?php
}
else{
?>
var JM=200000;
<?php
}
foreach($arr as $d) {
$kd_sem=$d["id_restoran"];
$id_restoran0=$d["id_restoran"];
$nama_restoran=$d["nama_restoran"];
$alamat=$d["alamat"];
$telepon=$d["telepon"];
$lat=$d["latitude"];
$long=$d["longitude"];
$gambar=$d["gambar"];
?>
var lat2= <?php echo $lat;?>;
var lon2= <?php echo $long;?>;
var R = 6371; // km
//has a problem with the .toRad() method below.
var x1 = lat2-lat1;
var dLat = x1.toRad();
var x2 = lon2-lon1;
var dLon = x2.toRad();
var a = Math.sin(dLat/2) * Math.sin(dLat/2) +
Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) *
Math.sin(dLon/2) * Math.sin(dLon/2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
var d = R * c;
<?php if(isset($_POST["Set"])){ ?>
if(d <= JM){
arLat[n]= <?php echo $lat;?>;
arLon[n]= <?php echo $long;?>;
arNama[n]= "<?php echo $nama_restoran;?>";
arLok[n]= "<?php echo "Hasil cari <=".$_POST["jarak"]."KM : $nama_restoran $alamat #<a href='index.php?mnu=direction&x=$lat&y=$long'>Go Direction</a>";?>";
arJarak[n]=d;
n=n+1;
}//<=
<?php
}//isset
else{
?>
arLat[n]= <?php echo $lat;?>;
arLon[n]= <?php echo $long;?>;
arNama[n]= "<?php echo $nama_restoran;?>";
arLok[n]= "<?php echo "Hasil Semua Data : $nama_restoran $alamat #<a href='index.php?mnu=direction&x=$lat&y=$long'>Go Direction</a>";?>";
arJarak[n]=d;
n=n+1;
<?php
}//else
}//foreach
?>
for (var i = 0; i < n; i++) {
var location = new google.maps.LatLng(arLat[i],arLon[i]);
var marker = new google.maps.Marker({
position: location,
map: map
});
marker.setTitle(arNama[i]);
var content=arNama[i]+"\n"+arLok[i]+" jarak :"+arJarak[i]+" KM";
attachSecretMessage(marker, content);
}
}
function attachSecretMessage(marker, lokasi) {
var infowindow = new google.maps.InfoWindow({content: lokasi,size: new google.maps.Size(50,50)});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<body>
<div id="map_canvas" style="width:100%;height:500px;"></div>
<br>
<div align="right">
<form action="" method="post">
Set jarak <input type="text" name="jarak" id="jarak" value="<?php echo $setjarak;?>">
<input type="submit" value="Set" name="Set">
</form>
</div>
</body>
<?php
function process($conn,$sql){
$s=false;
$conn->autocommit(FALSE);
try {
$rs = $conn->query($sql);
if($rs){
$conn->commit();
$last_inserted_id = $conn->insert_id;
$affected_rows = $conn->affected_rows;
$s=true;
}
}
catch (Exception $e) {
echo 'fail: ' . $e->getMessage();
$conn->rollback();
}
$conn->autocommit(TRUE);
return $s;
}
function getJum($conn,$sql){
$rs=$conn->query($sql);
$jum= $rs->num_rows;
$rs->free();
return $jum;
}
function getField($conn,$sql){
$rs=$conn->query($sql);
$rs->data_seek(0);
$d= $rs->fetch_assoc();
$rs->free();
return $d;
}
function getData($conn,$sql){
$rs=$conn->query($sql);
$rs->data_seek(0);
$arr = $rs->fetch_all(MYSQLI_ASSOC);
//foreach($arr as $row) {
// echo $row['nama_kelas'] . '*<br>';
//}
$rs->free();
return $arr;
}
?>
HASILNYA:
Untuk direction gunakan kode sbb:
OK Mudah yaaaa
Senin, 09 Desember 2019
PDF 2 WORD
<?php
require 'pdfcrowd.php';
$client = new \Pdfcrowd\HtmlToPdfClient("sahrulrasyid", "360c2654be6b37707a1c512bdcb39db8");
$pdf = $client->convertUrl("https://en.wikipedia.org/wiki/Main_Page");
?>
DOWNLOAD LIB
require 'pdfcrowd.php';
$client = new \Pdfcrowd\HtmlToPdfClient("sahrulrasyid", "360c2654be6b37707a1c512bdcb39db8");
$pdf = $client->convertUrl("https://en.wikipedia.org/wiki/Main_Page");
?>
DOWNLOAD LIB
Langganan:
Postingan (Atom)
Selisih Waktu Berjalan
Berikut adalah fungsi PHP yang menghitung selisih hari antara tanggal saat ini dengan tanggal 2024-08-22 . Jika tanggal saat ini kurang dari...
-
<?php // <a href='download.php?file=$file' title='Download File'>Download Dokumen</a> $direktori = ...
-
Teman2 ...mungkin sering dapat kode random..... btw ini ada share sedikit ttg membuat soal random.....yang beda disini adalah sy menggunaka...
-
<?php $sql="select `id_admin` from `$tbadmin` order by `id_admin` desc"; $jum= getJum($conn,$sql); $kd="ADM"...