Skip to content

Instantly share code, notes, and snippets.

@malikkurosaki
Last active January 27, 2018 03:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malikkurosaki/46f08f84665d15ac0250b304a4d3f218 to your computer and use it in GitHub Desktop.
Save malikkurosaki/46f08f84665d15ac0250b304a4d3f218 to your computer and use it in GitHub Desktop.
this code is simple for mobile view
var xmlhttp = new xmlhttpRequest();
xmlhttp.onreadystatechange = function(){
if (this.readyState == 4 && this.status == 200) {
document.getElementById("name").innerHTML = this.responseText;
}
};
xmlhttp.open("GET","data/mydata.php?data=nama",true);
xmlhttp.send();
<?php
$host = "127.0.0.1:3306";
$user = "root";
$pass = "";
$db = "malikdata";
$coba = mysqli_connect($host,$user,$pass,$db);
if (!$coba) {
echo "database not connected";
}else {
echo "database connected perfect";
}
?>
<?php
$host = "127.0.0.1:3306";
$user = "root";
$pass = "";
$db = "malikdata";
$connect = mysqli_connect($host,$user,$pass,$db);
if (!$connect) {
echo "gagal koneksi ke database";
}
$show = "SHOW COLUMNS FROM halaman";
$hasil = mysqli_query($connect,$show);
while ($row = mysqli_fetch_array($hasil)) {
print_r($row);
}
?>
<!DOCTYPE html>
<html>
<head>
<title> name website</title>
<meta name='viewport' content='width = device-width, initial-scale = 1.0'> // for mobile view
<link rel='stylesheet' href='styles.css'> // for css
</head>
<body>
//content is here
</body>
<script type='text/javascript' src='scripts.js'></script> // for javascript
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment