Skip to content

Instantly share code, notes, and snippets.

View hndr91's full-sized avatar

Afif Hendrawan hndr91

  • Malang, ID
View GitHub Profile
@hndr91
hndr91 / chart.php
Last active December 21, 2015 19:09
<?php
include 'db_con.php';
$idbarang = $_GET['id_barang']; //mendapatkan informasi id barang dari file index.php
//melakukan query pada tabel penjualan sesaui dengan informasi id barang yang didapat dari metode GET
$sql = "select * from penjualan where id_barang = '".$idbarang."' ";
$query = mysql_query($sql);
//membuat kolom pada tabel
$tabel = array();
<?php
try{
$conn = mysql_connect("localhost","root",""); //isikan sesuai dengan alamat server,username, dan password
mysql_select_db("gchart",$conn);
}
catch(Exception $e)
{
echo $e->getMessage("koneksi gagal");
}
?>
<?php
//memanggil db_con.php untuk melakukan koneksi ke database
include "db_con.php";
?>
<html>
<head>
<title>Laporan Penjualan</title>
</head>
<body>
<h1>Laporan Penjualan</h1>
@hndr91
hndr91 / activity_main.xml
Last active October 3, 2015 10:22
Simple Android WebView - activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="4dp"
tools:context=".MainActivity">
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"
@hndr91
hndr91 / MainActivityOnCreate.java
Last active October 3, 2015 10:31
Simple Android WebView - onCreate
//Define URL
private static final String URL = "http://updatesepati.blogspot.com/";
//Define WebView
private WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webView = (WebView)findViewById(R.id.webView); //get webView
@hndr91
hndr91 / MainActivityOnKeyDown.java
Created October 3, 2015 10:32
Simple Android WebView - onKeyDown
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK && webView.canGoBack()) {
//back to previous url
webView.goBack();
return true;
}
return super.onKeyDown(keyCode, event);
}
@hndr91
hndr91 / manu_main.xml
Created October 3, 2015 10:35
Simple Android WebView - main_menu.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
<item android:id="@+id/action_exit"
android:title="@string/action_exit"
android:orderInCategory="100"
app:showAsAction="never" />
</menu>
@hndr91
hndr91 / MainActivitiOnItem.java
Created October 3, 2015 10:43
Simple Android WebView - onOptionItemSelected
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_exit) {
@hndr91
hndr91 / MainActivity.java
Created October 3, 2015 10:45
Simpe Android WebView - MainActivity.java
package com.webview;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
@hndr91
hndr91 / AndroidManifest.xml
Created October 3, 2015 10:47
Simple Android WebView - AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.webview" >
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"