Skip to content

Instantly share code, notes, and snippets.

Avatar

Ihwan IhwanID

View GitHub Profile
@IhwanID
IhwanID / sample-code-1.php
Created Aug 2, 2018
Sample code of if else, switch case, while, do while, for and foreach
View sample-code-1.php
<?php
$umur = 17;
// if else statement
if ($umur < 16){
echo "Wah Masih muda ya!";
}elseif ($umur = 17) {
echo "Umur kamu 17, yang semangat belajarnya";
} else {
@IhwanID
IhwanID / sample-code-2.php
Created Aug 2, 2018
sample code of show database from mysql phpmyadmin
View sample-code-2.php
<?php
//kodingan koneksi
$mysqli = mysqli_connect("localhost", "root", "", "sekolah");
//get database
$result = mysqli_query($mysqli, "SELECT * FROM siswa ORDER BY id DESC");
?>
@IhwanID
IhwanID / sample-code-3.php
Created Aug 3, 2018
sample code of function in php
View sample-code-3.php
<?php
function ucapSalam() {
echo "Assalamualaikum";
}
//cara panggil function
ucapSalam();
function namaKeluarga($namaAwal) {
View update_post.php
<?php
//session_start();
//if(! isset($_SESSION['loggedin']))
//exit('akses dilarang, silahkan login dulu');
include_once('config.php');
$judul = "Edit Post";
@IhwanID
IhwanID / create_post.php
Last active Aug 31, 2018
sample code of create post in workshop blog php
View create_post.php
<?php
//session_start();
//if(! isset($_SESSION['loggedin']))
//exit('akses dilarang, silahkan login dulu');
include_once('config.php');
$judul = "Tambah Post";
View delete_post.php
<?php
//session_start();
//if(! isset($_SESSION['loggedin']))
//exit('akses dilarang, silahkan login dulu');
include_once('config.php');
$id = $_GET['id'];
View login.php
<?php
session_start();
include_once('config.php');
$judul = "Login";
$subjudul = "";
$url_banner = "assets/img/home-bg.jpg";
if(isset($_POST['submit'])){
@IhwanID
IhwanID / lifecycle.java
Created Oct 15, 2018
java android lifecycle
View lifecycle.java
package id.ihwan.bpr_training_java;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
@IhwanID
IhwanID / latihan1.c
Last active Oct 20, 2018
Latihan menggunakan Bahasa C di Kampus STMIK Sumedang
View latihan1.c
#include <stdio.h>
int main(void){
printf("Welcome to C!\n");
int angka1;
int angka2;
int jumlah;
int hasilKali;
@IhwanID
IhwanID / main.c
Created Dec 22, 2018
If Else Pilih Jurusan dengan Bahasa C - STMIK Sumedang
View main.c
#include <stdio.h>
int
main ()
{
int nomor_jurusan;
printf ("Masukkan Nomor Jurusan yang dipilih (1-3) : ");
scanf ("%d", &nomor_jurusan);
if (nomor_jurusan == 1)