Created
October 6, 2015 03:04
-
-
Save zackad/e6e4a5a36e5432f8fce4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
#olahan{ | |
width: 800px; | |
} | |
textarea{ | |
width: 800px; | |
} | |
</style> | |
<script src="http://code.jquery.com/jquery-latest.min.js"></script> | |
<textarea name="text" onfocus="initiate()"></textarea> | |
<div id="olahan"></div> | |
<script> | |
function initiate(){ | |
mentah = $('textarea').val(); | |
$('#olahan').text(mentah); | |
text = $('#olahan').text(); | |
// delimiter each line is ':' | |
pecahan = text.split(':'); | |
hasil = ''; | |
for(i=0; i<pecahan.length; i++){ | |
// delimiter each value is ';' | |
data = pecahan[i].split(';'); | |
for(j=0; j<data.length; j++){ | |
nama = data[0]; | |
kota = data[1]; | |
alamat = data[2]; | |
koord_y_lat = data[3]; | |
koord_x_lng = data[4]; | |
hasil = hasil + 'INSERT INTO venue (nama, kota, alamat, koord_y_lat, koord_x_lng, image_path) VALUES ("' | |
+ nama +'","' | |
+ kota +'","' | |
+ alamat +'","' | |
+ koord_y_lat +'","' | |
+ koord_x_lng +'","' | |
+ '"upload/venue.png");'; | |
} | |
} | |
$('#olahan').text(hasil); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment