Created
January 17, 2013 16:19
-
-
Save adam14/4557166 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
1. buat lah databases dengan nama kampus_12105179 | |
2. ekspor "resto.sql" ke dalam database kampus_12105179 | |
3. di bagian koneksi.php ubah "password" sesuai dengan yang anda punya. | |
http://adamkhamarullah.blogspot.com/ | |
TERIMA KASIH |
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
<?php | |
include "koneksi.php"; | |
$no_struk=$_GET['no_struk']; | |
$query=stripslashes($query); | |
$query=mysql_query("delete from resto where no_struk='$no_struk'",$koneksi); | |
if($query) | |
{ | |
echo "<h1 align=center><font face=algerian size=+1>No Struk $no_struk Berhasil Terhapus !</font></h1>"; | |
include("tampil.php"); | |
} | |
else | |
{ | |
echo "<h1 align=center><font face=algerian size=+1>Data Anda Gagal Terhapus !</font></h1>"; | |
include("tampil.php"); | |
} | |
?> |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>Untitled Document</title> | |
</head> | |
<body> | |
<?php | |
include "koneksi.php"; | |
$no_struk=$_GET['no_struk']; | |
$edit=mysql_query("select * from resto where no_struk='$no_struk'",$koneksi); | |
$data=mysql_fetch_array($edit); | |
if($data['pelanggan'] == "Customer") | |
{ | |
$customer="<input type=radio name=pelanggan value=Customer checked>"; | |
$non="<input type=radio name=pelanggan value='Non Customer'>"; | |
} | |
elseif($data['pelanggan'] == "Non Customer") | |
{ | |
$customer="<input typer=radio name=pelanggan value=Customer>"; | |
$non="<input type=radio name=pelanggan value='Non Customer' checked>"; | |
} | |
echo "<h2 align=center><font face='algerian' size=+1>Edit Data Resto Makan Murah Meriah</font></h2>"; | |
echo "<form action=update.php method=post> | |
<br /> | |
<table border=0 cellpadding=3 cellspacing=3 align=center> | |
<tr> | |
<td>No Struk</td> | |
<td><input type=text size=10 readonly=true name=no_struk value=$data[no_struk]></td> | |
</tr> | |
<tr> | |
<td valign=top>Pelanggan</td> | |
<td>$customer Customer <br> $non Non Customer</td> | |
</tr> | |
<tr> | |
<td>Kode Paket</td> | |
<td><select name=kode_paket> | |
<option value='$data[kd_paket]'>$data[kd_paket]</option> | |
<option value='Paket 1'>Paket 1</option> | |
<option value='Paket 2'>Paket 2</option> | |
<option value='Paket 3'>Paket 3</option> | |
<option value='Paket 4'>Paket 4</option> | |
</select></td> | |
</tr> | |
<tr> | |
<td>Jumlah Beli</td> | |
<td><input type=text size=5 name=jumlah_beli value=$data[jumlah_beli]></td> | |
</tr> | |
<tr> | |
<td colspan=2 align=right><input type=submit value=Update></td> | |
</tr> | |
</table> | |
</form>"; | |
?> | |
</body> | |
</html> |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>Untitled Document</title> | |
</head> | |
<body> | |
<h2 align="center"><font face="Algerian" size="+1">Resto Makanan Murah Meriah</font></h2> | |
<form action="simpan.php" method="post"> | |
<table border="0" cellpadding="3" cellspacing="3" align="center"> | |
<tr> | |
<td>No Struk</td> | |
<td><input type="text" name="no_struk" size="10" /></td> | |
</tr> | |
<tr> | |
<td valign="top">Pelanggan</td> | |
<td><input type="radio" value="Customer" name="pelanggan" />Customer<br /> | |
<input type="radio" value="Non Customer" name="pelanggan" />Non Customer</td> | |
</tr> | |
<tr> | |
<td>Kode Paket</td> | |
<td><select name="kode_paket"> | |
<option>--Click Here--</option> | |
<option value="Paket 1">Paket 1</option> | |
<option value="Paket 2">Paket 2</option> | |
<option value="Paket 3">Paket 3</option> | |
<option value="Paket 4">Paket 4</option> | |
</select></td> | |
</tr> | |
<tr> | |
<td>Jumlah Beli</td> | |
<td><input type="text" name="jumlah_beli" size="5" /></td> | |
</tr> | |
<tr> | |
<td colspan="2" align="right"><input type="submit" value="Simpan" /> <input type="reset" value="Batal" /></td> | |
</tr> | |
</table> | |
</form> | |
</body> | |
</html> |
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
<?php | |
$koneksi=mysql_connect("localhost","root","password") or die(mysql_error()); | |
mysql_select_db("kampus_12105179",$koneksi) or die(mysql_error()); | |
?> |
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
-- phpMyAdmin SQL Dump | |
-- version 2.7.0-pl2 | |
-- http://www.phpmyadmin.net | |
-- | |
-- Host: localhost | |
-- Waktu pembuatan: 06. Januari 2013 jam 23:55 | |
-- Versi Server: 5.0.18 | |
-- Versi PHP: 5.1.2 | |
-- | |
-- Database: `kampus_12105179` | |
-- | |
-- -------------------------------------------------------- | |
-- | |
-- Struktur dari tabel `resto` | |
-- | |
CREATE TABLE `resto` ( | |
`no_struk` char(10) NOT NULL, | |
`pelanggan` varchar(100) default NULL, | |
`kd_paket` char(10) default NULL, | |
`menu_makan` varchar(255) default NULL, | |
`harga` int(11) default NULL, | |
`jumlah_beli` int(11) default NULL, | |
`total_harga` double default NULL, | |
`diskon` int(11) default NULL, | |
`total_bayar` double default NULL, | |
PRIMARY KEY (`no_struk`) | |
) ENGINE=MyISAM DEFAULT CHARSET=latin1; | |
-- | |
-- Dumping data untuk tabel `resto` | |
-- | |
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
<?php | |
include "koneksi.php"; | |
$no_struk=$_POST['no_struk']; | |
$pelanggan=$_POST['pelanggan']; | |
if($kode_paket=='Paket 1') | |
{ | |
$menu_makan="Burger Spesial"; | |
$harga=15000; | |
} | |
elseif($kode_paket=='Paket 2') | |
{ | |
$menu_makan="Spagheti Beef"; | |
$harga=30000; | |
} | |
elseif($kode_paket=='Paket 3') | |
{ | |
$menu_makan="Mocca Float"; | |
$harga=10000; | |
} | |
else | |
{ | |
$menu_makan="Es Krim Sunday"; | |
$harga=6000; | |
} | |
$jumlah_beli=$_POST['jumlah_beli']; | |
$total_harga=$jumlah_beli*$harga; | |
if($total_harga>=100000) | |
{ | |
$diskon=0.1*$total_harga; | |
} | |
else | |
{ | |
$diskon=0; | |
} | |
$total_bayar=$total_harga-$diskon; | |
$query="insert into resto(no_struk,pelanggan,kd_paket,menu_makan,harga,jumlah_beli,total_harga,diskon,total_bayar) values ('$no_struk','$pelanggan','$kode_paket','$menu_makan','$harga','$jumlah_beli','$total_harga','$diskon','$total_bayar')"; | |
$simpan=mysql_query($query); | |
if($simpan) | |
{ | |
echo "<h2><marquee>No Struk $no_struk Berhasil Tersimpan !</marquee></h2>"; | |
echo "<br><a href=index.php>Kembali Input</a>"; | |
echo "<br><a href=tampil.php>Lihat Data</a>"; | |
} | |
else | |
{ | |
echo "<h2><marquee>Anda Gagal Menyimpan Data !</marquee></h2>"; | |
echo "<br><a href=index.php>Kembali Input</a>"; | |
} | |
?> |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>Untitled Document</title> | |
</head> | |
<body> | |
<h2 align="center"><font face="Algerian" size="+1">Resto Makan Murah Meriah</font></h2> | |
<table border="1" cellpadding="3" cellspacing="3" align="center"> | |
<tr> | |
<th>No Struk</th> | |
<th>Pelanggan</th> | |
<th>Kode Paket</th> | |
<th>Menu Makan</th> | |
<th>Harga</th> | |
<th>Jumlah Beli</th> | |
<th>Total Harga</th> | |
<th>Diskon</th> | |
<th>Total Bayar</th> | |
<th>Action</th> | |
</tr> | |
<?php | |
include "koneksi.php"; | |
$proses=mysql_query("select * from resto order by no_struk desc"); | |
while($data=mysql_fetch_array($proses)) | |
{ | |
echo "<tr> | |
<td>$data[no_struk]</td> | |
<td>$data[pelanggan]</td> | |
<td>$data[kd_paket]</td> | |
<td>$data[menu_makan]</td> | |
<td>$data[harga]</td> | |
<td>$data[jumlah_beli]</td> | |
<td>$data[total_harga]</td> | |
<td>$data[diskon]</td> | |
<td>$data[total_bayar]</td> | |
<td><a href=edit.php?no_struk=$data[no_struk]>Edit</a> <a href=delete.php?no_struk=$data[no_struk]>Delete</a></td> | |
<tr>"; | |
} | |
?> | |
</table> | |
<br /> | |
<a href="index.php">Kembali Input</a> | |
</body> | |
</html> |
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
<?php | |
include "koneksi.php"; | |
$no_struk=$_POST['no_struk']; | |
$pelanggan=$_POST['pelanggan']; | |
if($kode_paket=='Paket 1') | |
{ | |
$menu_makan="Burger Spesial"; | |
$harga=15000; | |
} | |
elseif($kode_paket=='Paket 2') | |
{ | |
$menu_makan="Spagheti Beef"; | |
$harga=30000; | |
} | |
elseif($kode_paket=='Paket 3') | |
{ | |
$menu_makan="Mocca Float"; | |
$harga=10000; | |
} | |
else | |
{ | |
$menu_makan="Es Krim Sunday"; | |
$harga=6000; | |
} | |
$jumlah_beli=$_POST['jumlah_beli']; | |
$total_harga=$jumlah_beli*$harga; | |
if($total_harga>=100000) | |
{ | |
$diskon=0.1*$total_harga; | |
} | |
else | |
{ | |
$diskon=0; | |
} | |
$total_bayar=$total_harga-$diskon; | |
$query="update resto set pelanggan='$pelanggan',kd_paket='$kode_paket',menu_makan='$menu_makan',harga='$harga',jumlah_beli='$jumlah_beli',total_harga='$total_harga',diskon='$diskon',total_bayar='$total_bayar' where no_struk='$no_struk'"; | |
$update=mysql_query($query); | |
if($update) | |
{ | |
echo "<h1 align=center><font face=algerian size=+1>No Struk $no_struk Berhasil Diperbaharui !</font></h2>"; | |
include("tampil.php"); | |
} | |
else | |
{ | |
echo "<h1 align=center><font face=algerian size=+1>Data Anda Gagal Diperbaharui !</font></h1>"; | |
include("tampil.php"); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment