Skip to content

Instantly share code, notes, and snippets.

@hidayat365
hidayat365 / replace.php
Created May 14, 2012 15:27
String Replacer
<?php
if ($_GET['Proses'])
{
$awal = $_GET["awal"];
$Decrypter_variables = array(
"1", "2", "3", "4", "5", "6", "7", "8", "9",
"%", "!", "@", "#", "$", "^", "&", "*", "~",
"+", ":", "-", "=", "?", "'", ".", "<" );
$Variables_assign = array(
"a", "b", "c", "d", "e", "f", "g", "h", "i",
@hidayat365
hidayat365 / output.sql
Created May 15, 2012 04:16
Output Hitung Stok PostrgreSQL
psql (9.1.1)
WARNING: Console code page (850) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
Type "help" for help.
sample=# -- data barang masuk;
sample=# select * from barang_masuk;
id | item_id | tanggal | quantity
@hidayat365
hidayat365 / crosstab.sql
Last active October 8, 2021 07:17
MySQL CrossTab
PS C:\Users\hiday> mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 26
Server version: 10.5.7-MariaDB-log mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use test
@hidayat365
hidayat365 / summary.sql
Created May 19, 2012 14:54
Summary SQL
select kelas, count(*) as jumlah
from (
select nis, max(kelas) kelas
from tabel
group by nis
) as summary
group by kelas
@hidayat365
hidayat365 / trigger1.sql
Created June 25, 2012 16:06
Contoh CREATE TRIGGER MySQL
DELIMITER $$
CREATE TRIGGER grafik
AFTER UPDATE ON plan
FOR EACH ROW
BEGIN
IF (EXISTS(SELECT `TGL_MULAI` FROM plan WHERE MONTH(`TGL_MULAI`)='05')) THEN
@hidayat365
hidayat365 / totok.txt
Created July 8, 2012 13:35
Bang Totok Ganteng
D:\xampp\mysql\bin>mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.5.16 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
@hidayat365
hidayat365 / deret.php
Created July 13, 2012 04:33
Problem Deret
<?php
/****
* Belum sesuai seperti yang diminta
* tapi sudah mendekati, silakan modifikasi sendiri
****/
for ($i=1; $i<=100; $i+=4) {
for ($j=0; $j<4; $j++) {
print $i+$j.' ';
print ($j%4==0 or $j%4==3) ? 'a ' : '';
@hidayat365
hidayat365 / deretv2.php
Created July 13, 2012 07:49
Problem Deret v2
<?php
// looping terluar untuk menghitung
// angka dari 1 sampai 100 dengan increment 4
for ($i=1; $i<=100; $i+=4) {
// looping dalam untuk menampilkan tiap baris angka
// masing2 baris angka terdiri dari empat bilangan
for ($j=0; $j<4; $j++) {
@hidayat365
hidayat365 / mizno.txt
Created August 8, 2012 07:10
Untuk Om Mizno
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.5.16 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
@hidayat365
hidayat365 / running_total.sql
Last active November 12, 2018 07:51
Windowed Running Total MySQL feat. @RidhoPrasetya
D:\xampp\mysql\bin>mysql.exe -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.5.16 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.