Semester 6
Pertemuan 1
Pembuatan Database
Pertemuan 2
Pembuatan Menubar
Pertemuan 3
Membuat Polling/pilihan
Pertemuan 4
Hitcounter/Menampilkan jumlah pengunjung
Pertemuan 5
Buku tamu
Pertemuan 6
Daftar anggota ukm
Pertemuan 7
Login Administrator
Pertemuan 8
Menambah gambar diphp
Pertemuan 9
$_GET
Pertemuan 10
Menampilkan data dari 3 table
Pertemuan 11
Update data
Pertemuan 12
Hapus Data
Pertemuan 13
Membuat FPDF
Ecom 14
Menampilkan Data print preview
Pertemuan 13
Membuat FPDF
======================================
Pertemuan 1
Pertemuan ini menjelaskan tenatang
pembuatan Database
Pertemuan 2
Pertemuan ini
Menjelaskan tentang membuat
menubar dengan menggunakan
Menu CSS generator
Alamat Disini
https://drive.google.com/open?id=1MjUT9-5xbNvPY7TcL5ShBky2yz-01iU5
Pertemuan 3
Pertemuan ini Membahas tentang polling
Pilihan Website
Halamn web untuk memilih pelayanan
1.Buat lah nama db = baru dan tabel = vote
2.Rancanglah tampilan dg nama pol.php
Pelayanan E-Commerce Terbaik
Vote
3.Program update polling
(prosespos.php)
<?php
mysql_connect("localhost","root","");
mysql_select_db("baru");
$pil = $_POST['tpilihan'];
if($pil == "1")
{
mysql_query("update vote set lazada = lazada +1");
}
else if($pil == "2")
{
mysql_query("update vote set shopie = shopie +1 ");
}
else if($pil == "3")
{
mysql_query("update vote set tokopedia = tokopedia +1");
}else
{
mysql_query("update vote set zelora = zelora + 1");
}
echo "<h2><marque>Terimakasih Atas Pilihan Anda</marque></h2>"
?>
4.Program Tampil Polling (tampilpol.php)
<?php
mysql_connect("localhost","root","");
mysql_select_db("baru");
$cari = mysql_query("select * from vote");
$data = mysql_fetch_array($cari);
$jlh1 = $data[0];
$jlh2 = $data[1];
$jlh3 = $data[2];
$jlh4 = $data[3];
$total = $jlh1 + $jlh2 + $jlh3 + $jlh4$;
$p1 = round($jlh1/$total*100,2);//untuk mengambil nilai desimal dari belakang dua digit
$p2 =round($jlh/$total*100,2);
$p3 = round($jlh/$total*100,2);
$p4 = round($jlh/$total*100,2);
echo"<h2>Hasil Sementara</h2>"
?>
Lazada
<table>
<tr>
<td width="<?php = $p1?>" bgcolor="red" height="10">
<td><?php echo $p1 ."%"?></td>
</tr>
</table><br>
shopie
<table>
<tr>
<td width="<?php = $p2?>" bgcolor="greend" height="10"><td>
<td><?php echo $p2 ."%"?><td>
</tr>
</table><br>
Tokopedia
<table>
<tr>
<td width="<?php = $p3?>" bgcolor="yellow" height="10"></td>
<td><?php echo $p3. "%"?></td>
</tr>
</table><br>
Zelora
<table>
<tr>
<td width="<?php =$p4?>" bgcolor="black" height="10"></td>
<td><?php echo $p4."%"?></td>
</tr>
</table>
klik <a href="pol.php">Kembali</a>
Kehalaman Utama
Pertemuan4
Hitcounter
=>halaman web yang digunakan untuk menghitung jumlah pengunjung
index.php
<?php
session_start();
mysql_connect("localhost","root","");
mysql_select_db("dbPengunjung");
if(!isset($_SESSION['okay']))
{
$_SESSION['okay']=session_id();
mysql_query("update pendatang set jumlah = jumlah + 1");
}
$data = mysql_query("select * from pendatang ");
$tampil = mysql_fetch_array($data);
$a = $tampil[0];
echo "<h1>Anda pengunjung Ke ".$a;
?>
Pertemuan 5
Buku tamu
1.Buatlah database dan table
2.Rencanglah Form buku tamu
nama =
alaman =
email =
jenis kelamin =
komentar =
kirim batal= reset form
placeholder = Masukan nama lengkap
3.Kode program
<?php
myql_connect("localhost","root","");
mysql_select_db("bukutamu");
$nama = $_POST['t1'];
$alamat = $_POST['t2'];
$jenkel = $_POST['t3'];
$komentar = $_POST['t4'];
$tanggal = Date("Y-m-d");
mysql_query("insert into buku values('$nama','$alamat','$emali','$jenkel',
'$komentar','$tanggal')");
echo "<h2>Data Sudah Disimpan</h2><br>";
echo "<marquee>Terimakasih sudah memberikan kritik dan saran</marquee>";
?>
<a href="formbertamu.php">Kembali Ke Formulir</a>
POST =>tidak ditampilkan di url website
Pertemuan 6
Daftar anggota UKM
1.Rancang db = Valentine
Rancang Tabel = anggota
2.Rancang table dan form untuk anggota
nama vc 50
jengkel vc 50
alamat vc 50
nohp vc 50
tgllahir Date 50
Email vc 50
password vc 50
<select name = "t5" and id="t5">
<?php
for($a=1,$a<=31,$a++)
{
echo "<option>$a</option>";
}
?>
</select>
3.Rancanglah kode program
<?php
mysql_connect("localhost","root","");
mysql_select_db("valentine");
$nama = $_POST['t1'];
$jenkel = $_POST['t2'];
$alamat = $_POST['t3'];
$nohp = $_POST['t4'];
$tgl = $_POST['t5'];
$bln = $_POST['t6'];
$thn = $_POST['t7'];
$tgllahir = "$thn-$bln-$tgl";
$email = $_POST['t8'];
$password = $_POST['t9'];
$tampil = mysql_query("select * from anggota where email = '$email' ");
$uji = mysql_num_rows($tampil);
if($uji>0)
{
echo "<script>alert("Email Anda Sudah Terdaptar")</script>";
include "formukm.php";
exit;
}
mysql_query("insert into anggota values('$nama','$jenkel','$alamat','nohp',
'$tgllahir','$email','$password')");
echo "<script>alert("Data Anda Sudah Disimpan")</script>";
?>
<a href="formukm.php">Kembali Ke formulir</a>
<h2><marquee behavior="alternate">Terimakasih Sudah Mendaptar</marquee></h2>//alternate text manttul,scroll tembus
Pertemuan 7
Login Administrator
1.Rancang Dbase dan Table
nama db = Ecom7x
nama table = Login
username varchar (30) admin
password varchar (8) 123456
2.Rancanglah form login administrator
nama file formx1.php
Formulir Login Adminstrator
Username =
Password =
Login Batal
action prosesx1 php
method post
-Tandai objek password
-pada properties pilih password
tandai tombol batal
pilih reset form
3.Program Login Administrator(proses.php)
<?php
mysql_connect("localhost","root","");
mysql_select_db("ecom7");
$u = $_POST['t1'];
$p = $_POST['t2'];
$tampung = mysql_query("select * from login where username ='$u' and password ='$p'");
$uji = mysql_fetch_array($tampung);
if($uji==0)
{
echo "<script>alert("username dan password salah")</script>";
include "formx1.php":
}
else
{
$_SESSION['user'] = $u;
$_SESSION['kunci'] = 'Berhasil';
}
?>
<meta http-equiv ="refresh" content="2;menux1.php">
4.Rancanglah Menu administrator dgn css menu generator menu.php
Beranda
input data
-data penjualan
-data pembelian
data barang
logout
5.Buatlah Program Keluar
logout.php
<?php
session_start();
session_destroy();
include"formx1.php";
exit;
?>
==================================
Pertemuan 8
Menambah gambar diphp
//Gunakan kode ini pada Form
enctype="multipart/form-data"
1.Rancang database = inputx dan table= barang
field
idbarang vc 20
nabar vc 20
harga int 20
gambar vc 30
2.Rancang Form
idbarang =
nama barang =
harga barang =
gambar =
simpan batal
action = simpan8.php
<?php
mysql_connect("localhost","root","");
mysql_select_db("inputx");
$id = $_POST['t1'];
$nabar = $_POST['t2'];
$harga = $_POST['t3'];
$gambar = $_FILES['t4']['name'];
$alamat = $_FILES['t4']['tmp_name'];
mysql_query("insert into barang values('$id','$nabar','$harga','$gambar')");
move_uploaded_file($alamat,"gambar/".$gambar); //gunakan titik jika tidak....
?>
Klik <a href="tampil8x.php">Disini</a>Kembali
ket => //gunakan titik jika tidak maka error //move_uploaded_file() expects exactly 2 parameters, 3 given
tampil8x.php
<?php
mysql_connect("localhost","root","");
mysql_select_db("inputx");
$a = mysql_query("select * from barang");
while($data = mysql_fetch_array($a))
{
echo "<img src='gambar/".$data[gambar]." ' width ="200px" height="300px">"."<br>";
echo "ID Barang = ".$data[idbarang]."<br>";
echo "Nabar = ".$data[nabar]."<br>";
echo "Harga = ".$data[harga]."<br>";
}
?>
Pertemuan 9
$_GET
File Click here
Buatlah database : dbecom9 dan table
tblProduk
kode vc 8
nabar vc 20
harga int 15
tblsementara
kode vc 10
nabar vc 10
harga int 10
jlh int 5
Tampil.php
<h3><center>Daftar</center></h3><hr>
<table border=1 width='70%'>
<tr bgcolor="cyan">
<th>No</th>
<th>Kode barang</th>
<th>Nama barang</th>
<th>Harga barang</th>
<th>Aksi</th>
</tr>
<?php
mysql_connect("localhost","root","");
mysql_select_db("dbecom9");
$no=0;
$ambil = mysql_query("select * from tblproduk");
while($data = mysql_fetch_array($ambil)){
$no++;
?>
<tr align="center" bgcolor="lightblue">
<td><?= $no?></td>
<td><?= $data[0]?></td>
<td><?= $data[1]?></td>
<td><?= $data[2]?></td>
<td><a href="formPesan.php?kobar=<?= $data[0]?>&nabar=<?= $data[1]?>&harga=<?= $data[2]?>">Pesan</a></td>
</tr>
<?php }?>
</table>
Frompesan.php
<form action="prosesSimpan.php" method="post">
<table>
<tr>
<td>Kode Barang</td>
<td><input type="text" name="t1" value="<?php echo $_GET['kobar']?>"></td>
</tr>
<tr>
<td>Nama Barang</td>
<td><input type="text" name="t2" value="<?php echo $_GET['nabar']?>"></td>
</tr>
<tr>
<td>Harga</td>
<td><input type="text" name="t3" value="<?php echo $_GET['harga']?>"></td>
</tr>
<tr>
<td>Jumlah</td>
<td><input type="text" name="t4" ></td>
</tr>
<tr>
<td colspan="2" align="center">
<button type="submit">Pesan</button>
<button type="">Batal</button>
</td>
</tr>
</table>
</form>
ProsesSimpan.php
<?php
mysql_connect("localhost","root","");
mysql_select_db("dbecom9");
$kode = $_POST['t1'];
$nabar = $_POST['t2'];
$harga = $_POST['t3'];
$jlh = $_POST['t4'];
mysql_query("insert into tblsementara values('$kode','$nabar','$harga','$jlh');");
?>
<meta http-equiv="refresh" content="2;tampil.php">
Pertemuan 10
Menampilkan data dari 3 table
word
Click here
$ambil = mysql_query("select tbl_pesan.tgl_pesan,tbl_pelanggan.nama,
tbl_pelanggan.email,tbl_pelanggan.alamat,tbl_pelanggan.nohp,tbl_produk.id_produk,
tbl_produk.nama_produk,tbl_pesan.harga,
tbl_pesan.jumlah,(tbl_pesan.harga*tbl_pesan.jumlah) as total From tbl_pelanggan,tbl_produk,tbl_pesan
where tbl_pelanggan.email = tbl_pesan.email and tbl_produk.id_produk = tbl_pesan.id_produk");
Pertemuan 11
Update Data
Word Click here
Pertemuan 12
Hapus Data
Click here
mysql_query(Delete from orderproduk where idorder='$idorder'");
Pertemuan 13
Membuat FPDF
File dan Download Fpdf17
Click here
Fpdf17
http://www.fpdf.org/en/download.php
barang.php
<?php
mysql_connect("localhost","root","");
mysql_select_db("dblapbarang")or die(mysql_error());
require('fpdf17/fpdf.php');
//Menampilkan data dari tabel di database
$tampung=mysql_query("SELECT * FROM Tbltoko") or die(mysql_error());
//Inisiasi untuk membuat header kolom
$k_kode = "";$k_nabar = "";$k_jenis = "";$k_harga = "";$k_jumlah = "";
//MEMBUAT FILE KOLOM
while($row = mysql_fetch_array($tampung))
{
$kode = $row["kode"];$nabar = $row["nabar"];$jenis = $row["jenis"];
$harga = $row["harga"];$jumlah = $row["jumlah"];
$k_kode = $k_kode.$kode."\n";$k_nabar = $k_nabar.$nabar."\n";
$k_jenis = $k_jenis.$jenis."\n";$k_harga = $k_harga.$harga."\n";
$k_jumlah = $k_jumlah.$jumlah."\n";
//Create a new PDF file
$pdf = new FPDF('P','mm',array(210,297));
$pdf->AddPage();
//MEMBUAT JUDUL
$pdf->SetFont('Arial','B',13);
$pdf->Cell(80);
$pdf->Cell(30,10,'LAPORAN DATA BARANG',0,0,'C');
$pdf->Ln();
$pdf->Cell(80);
$pdf->Cell(30,10,'USAHA KREATIF MAHASISWA MEDICOM',0,0,'C');
$pdf->Ln();
}
//MENENTUKAN POSISI FIELD
$posisinamafield = 30;
//First create each Field Name
//Gray color filling each Field Name box
$pdf->SetFillColor(110,180,230);
//Bold Font for Field Name
$pdf->SetFont('Arial','B',10);
$pdf->SetY($posisinamafield);
$pdf->SetX(50);
$pdf->Cell(25,8,'kode',1,0,'C',1);
$pdf->SetX(75);
$pdf->Cell(25,8,'nabar',1,0,'C',1);
$pdf->SetX(100);
$pdf->Cell(25,8,'jenis ',1,0,'C',1);
$pdf->SetX(125);
$pdf->Cell(25,8,'harga',1,0,'C',1);
$pdf->SetX(150);
$pdf->Cell(25,8,'jumlah',1,0,'C',1);
$pdf->Ln();
//Table position, under Fields Name
$Y_Table_Position = 38;
//Now show the columns
$pdf->SetFont('Arial','',10);
$pdf->SetY($Y_Table_Position);$pdf->SetX(50);
$pdf->MultiCell(25,6,$k_kode,1,'C');
$pdf->SetY($Y_Table_Position);$pdf->SetX(75);
$pdf->MultiCell(25,6,$k_nabar,1,'L');
$pdf->SetY($Y_Table_Position);$pdf->SetX(100);
$pdf->MultiCell(25,6,$k_jenis,1,'C');
$pdf->SetY($Y_Table_Position);$pdf->SetX(125);
$pdf->MultiCell(25,6,$k_harga,1,'C');
$pdf->SetY($Y_Table_Position);$pdf->SetX(150);
$pdf->MultiCell(25,6,$k_jumlah,1,'C');
$pdf->Output();?>
Ecom 14
Menampilkan Data print preview
File word
Click here
ecom14.php
<?php
mysql_connect("localhost","root","");
mysql_select_db("DBToko14");
require('fpdf17/fpdf.php');
//Menampilkan data dari tabel di database
$tampung=mysql_query("SELECT * FROM Tblbarang,Tblcustomer,orderan
where Tblbarang.kode=orderan.idorderan and orderan.idpel=TblCustomer.idpel") or die(mysql_error());
//Inisiasi untuk membuat header kolom
$k_id_order="";$k_tgl="";$k_id_pelanggan="";$k_nama_pelanggan="";
$k_kode = "";$k_nabar = "";$k_harga =
"";$k_jlh_order="";
//MEMBUAT FILE KOLOM
while($row = mysql_fetch_array($tampung))
{
$id_order=$row["idorderan"];$tgl=$row["tglorderan"];$id_pelanggan=$row["idpel"];$nama_pelanggan=$row["napel"];
$kode = $row["kode"];$nabar =
$row["nabar"];$harga = $row["harga"];
$jlh_order=$row["jlh"];
$k_id_order =
$k_id_order.$id_order."\n";
$k_tgl = $k_tgl.$tgl."\n";
$k_id_pelanggan =
$k_id_pelanggan.$id_pelanggan."\n";
$k_nama_pelanggan=
$k_nama_pelanggan.$nama_pelanggan."\n
";
$k_kode =
$k_kode.$kode."\n";$k_nabar =
$k_nabar.$nabar."\n";
$k_harga = $k_harga.$harga."\n";
$k_jlh_order=
$k_jlh_order.$jlh_order."\n";
//Create a new PDF file
$pdf = new
FPDF('P','mm',array(210,297));
$pdf->AddPage();
//MEMBUAT JUDUL
$pdf->SetFont('Arial','B',13);
$pdf->Cell(80);
$pdf->Cell(30,10,'LAPORAN DATA
PEMESANAN BARANG',0,0,'C');
$pdf->Ln();
$pdf->Cell(80);
$pdf->Cell(30,10,'USAHA KREATIF MAHASISWA MEDICOM',0,0,'C');
$pdf->Ln();
}
//MENENTUKAN POSISI FIELD
$posisinamafield = 30;
//First create each Field Name
//Gray color filling each Field Name box
$pdf->SetFillColor(110,180,230);
//Bold Font for Field Name
$pdf->SetFont('Arial','B',8);
$pdf->SetY($posisinamafield);
$pdf->SetX(10);
$pdf->Cell(25,8,'id order',1,0,'C',1);
$pdf->SetX(35);
$pdf->Cell(25,8,'tgl order',1,0,'C',1);
$pdf->SetX(60);
$pdf->Cell(25,8,'id pelanggan',1,0,'C',1);
$pdf->SetX(85);
$pdf->Cell(25,8,'nama',1,0,'C',1);
$pdf->SetX(110);
$pdf->Cell(25,8,'kode',1,0,'C',1);
$pdf->SetX(135);
$pdf->Cell(25,8,'nama barang',1,0,'C',1);
$pdf->SetX(160);
$pdf->Cell(25,8,'harga',1,0,'C',1);
$pdf->SetX(185);
$pdf->Cell(20,8,'jlh order',1,0,'C',1);
$pdf->Ln();
//Table position, under Fields Name
$Y = 38;
//Now show the columns
$pdf->SetFont('Arial','',8);
$pdf->SetY($Y);$pdf->SetX(10);
$pdf->MultiCell(25,6,$k_id_order,1,'C');
$pdf->SetY($Y);$pdf->SetX(35);
$pdf->MultiCell(25,6,$k_tgl,1,'L');
$pdf->SetY($Y);$pdf->SetX(60);
$pdf->MultiCell(25,6,$k_id_pelanggan,1,'C');
$pdf->SetY($Y);$pdf->SetX(85);
$pdf->MultiCell(25,3,$k_nama_pelanggan,1,'C'
);
$pdf->SetY($Y);$pdf->SetX(110);
$pdf->MultiCell(25,6,$k_kode,1,'C');
$pdf->SetY($Y);$pdf->SetX(135);
$pdf->MultiCell(25,6,$k_nabar,1,'C');
$pdf->SetY($Y);$pdf->SetX(160);
$pdf->MultiCell(25,6,$k_harga,1,'C');
$pdf->SetY($Y);$pdf->SetX(185);
$pdf->MultiCell(20,6,$k_jlh_order,1,'C');
$pdf->Output();?>
Pembuatan Database
Pertemuan 2
Pembuatan Menubar
Pertemuan 3
Membuat Polling/pilihan
Pertemuan 4
Hitcounter/Menampilkan jumlah pengunjung
Pertemuan 5
Buku tamu
Pertemuan 6
Daftar anggota ukm
Pertemuan 7
Login Administrator
Pertemuan 8
Menambah gambar diphp
Pertemuan 9
$_GET
Pertemuan 10
Menampilkan data dari 3 table
Pertemuan 11
Update data
Pertemuan 12
Hapus Data
Pertemuan 13
Membuat FPDF
Ecom 14
Menampilkan Data print preview
Pertemuan 13
Membuat FPDF
======================================
Pertemuan 1
Pertemuan ini menjelaskan tenatang
pembuatan Database
Pertemuan 2
Pertemuan ini
Menjelaskan tentang membuat
menubar dengan menggunakan
Menu CSS generator
Alamat Disini
https://drive.google.com/open?id=1MjUT9-5xbNvPY7TcL5ShBky2yz-01iU5
Pertemuan 3
Pertemuan ini Membahas tentang polling
Pilihan Website
Halamn web untuk memilih pelayanan
1.Buat lah nama db = baru dan tabel = vote
2.Rancanglah tampilan dg nama pol.php
Pelayanan E-Commerce Terbaik
- lazada
- shopie
- tokopedia
- zalora
Vote
3.Program update polling
(prosespos.php)
<?php
mysql_connect("localhost","root","");
mysql_select_db("baru");
$pil = $_POST['tpilihan'];
if($pil == "1")
{
mysql_query("update vote set lazada = lazada +1");
}
else if($pil == "2")
{
mysql_query("update vote set shopie = shopie +1 ");
}
else if($pil == "3")
{
mysql_query("update vote set tokopedia = tokopedia +1");
}else
{
mysql_query("update vote set zelora = zelora + 1");
}
echo "<h2><marque>Terimakasih Atas Pilihan Anda</marque></h2>"
?>
4.Program Tampil Polling (tampilpol.php)
<?php
mysql_connect("localhost","root","");
mysql_select_db("baru");
$cari = mysql_query("select * from vote");
$data = mysql_fetch_array($cari);
$jlh1 = $data[0];
$jlh2 = $data[1];
$jlh3 = $data[2];
$jlh4 = $data[3];
$total = $jlh1 + $jlh2 + $jlh3 + $jlh4$;
$p1 = round($jlh1/$total*100,2);//untuk mengambil nilai desimal dari belakang dua digit
$p2 =round($jlh/$total*100,2);
$p3 = round($jlh/$total*100,2);
$p4 = round($jlh/$total*100,2);
echo"<h2>Hasil Sementara</h2>"
?>
Lazada
<table>
<tr>
<td width="<?php = $p1?>" bgcolor="red" height="10">
<td><?php echo $p1 ."%"?></td>
</tr>
</table><br>
shopie
<table>
<tr>
<td width="<?php = $p2?>" bgcolor="greend" height="10"><td>
<td><?php echo $p2 ."%"?><td>
</tr>
</table><br>
Tokopedia
<table>
<tr>
<td width="<?php = $p3?>" bgcolor="yellow" height="10"></td>
<td><?php echo $p3. "%"?></td>
</tr>
</table><br>
Zelora
<table>
<tr>
<td width="<?php =$p4?>" bgcolor="black" height="10"></td>
<td><?php echo $p4."%"?></td>
</tr>
</table>
klik <a href="pol.php">Kembali</a>
Kehalaman Utama
Pertemuan4
Hitcounter
=>halaman web yang digunakan untuk menghitung jumlah pengunjung
index.php
<?php
session_start();
mysql_connect("localhost","root","");
mysql_select_db("dbPengunjung");
if(!isset($_SESSION['okay']))
{
$_SESSION['okay']=session_id();
mysql_query("update pendatang set jumlah = jumlah + 1");
}
$data = mysql_query("select * from pendatang ");
$tampil = mysql_fetch_array($data);
$a = $tampil[0];
echo "<h1>Anda pengunjung Ke ".$a;
?>
Pertemuan 5
Buku tamu
1.Buatlah database dan table
2.Rencanglah Form buku tamu
nama =
alaman =
email =
jenis kelamin =
komentar =
kirim batal= reset form
placeholder = Masukan nama lengkap
3.Kode program
<?php
myql_connect("localhost","root","");
mysql_select_db("bukutamu");
$nama = $_POST['t1'];
$alamat = $_POST['t2'];
$jenkel = $_POST['t3'];
$komentar = $_POST['t4'];
$tanggal = Date("Y-m-d");
mysql_query("insert into buku values('$nama','$alamat','$emali','$jenkel',
'$komentar','$tanggal')");
echo "<h2>Data Sudah Disimpan</h2><br>";
echo "<marquee>Terimakasih sudah memberikan kritik dan saran</marquee>";
?>
<a href="formbertamu.php">Kembali Ke Formulir</a>
POST =>tidak ditampilkan di url website
Pertemuan 6
Daftar anggota UKM
1.Rancang db = Valentine
Rancang Tabel = anggota
2.Rancang table dan form untuk anggota
nama vc 50
jengkel vc 50
alamat vc 50
nohp vc 50
tgllahir Date 50
Email vc 50
password vc 50
<select name = "t5" and id="t5">
<?php
for($a=1,$a<=31,$a++)
{
echo "<option>$a</option>";
}
?>
</select>
3.Rancanglah kode program
<?php
mysql_connect("localhost","root","");
mysql_select_db("valentine");
$nama = $_POST['t1'];
$jenkel = $_POST['t2'];
$alamat = $_POST['t3'];
$nohp = $_POST['t4'];
$tgl = $_POST['t5'];
$bln = $_POST['t6'];
$thn = $_POST['t7'];
$tgllahir = "$thn-$bln-$tgl";
$email = $_POST['t8'];
$password = $_POST['t9'];
$tampil = mysql_query("select * from anggota where email = '$email' ");
$uji = mysql_num_rows($tampil);
if($uji>0)
{
echo "<script>alert("Email Anda Sudah Terdaptar")</script>";
include "formukm.php";
exit;
}
mysql_query("insert into anggota values('$nama','$jenkel','$alamat','nohp',
'$tgllahir','$email','$password')");
echo "<script>alert("Data Anda Sudah Disimpan")</script>";
?>
<a href="formukm.php">Kembali Ke formulir</a>
<h2><marquee behavior="alternate">Terimakasih Sudah Mendaptar</marquee></h2>//alternate text manttul,scroll tembus
Pertemuan 7
Login Administrator
1.Rancang Dbase dan Table
nama db = Ecom7x
nama table = Login
username varchar (30) admin
password varchar (8) 123456
2.Rancanglah form login administrator
nama file formx1.php
Formulir Login Adminstrator
Username =
Password =
Login Batal
action prosesx1 php
method post
-Tandai objek password
-pada properties pilih password
tandai tombol batal
pilih reset form
3.Program Login Administrator(proses.php)
<?php
mysql_connect("localhost","root","");
mysql_select_db("ecom7");
$u = $_POST['t1'];
$p = $_POST['t2'];
$tampung = mysql_query("select * from login where username ='$u' and password ='$p'");
$uji = mysql_fetch_array($tampung);
if($uji==0)
{
echo "<script>alert("username dan password salah")</script>";
include "formx1.php":
}
else
{
$_SESSION['user'] = $u;
$_SESSION['kunci'] = 'Berhasil';
}
?>
<meta http-equiv ="refresh" content="2;menux1.php">
4.Rancanglah Menu administrator dgn css menu generator menu.php
Beranda
input data
-data penjualan
-data pembelian
data barang
logout
5.Buatlah Program Keluar
logout.php
<?php
session_start();
session_destroy();
include"formx1.php";
exit;
?>
==================================
Pertemuan 8
Menambah gambar diphp
//Gunakan kode ini pada Form
enctype="multipart/form-data"
1.Rancang database = inputx dan table= barang
field
idbarang vc 20
nabar vc 20
harga int 20
gambar vc 30
2.Rancang Form
idbarang =
nama barang =
harga barang =
gambar =
simpan batal
action = simpan8.php
<?php
mysql_connect("localhost","root","");
mysql_select_db("inputx");
$id = $_POST['t1'];
$nabar = $_POST['t2'];
$harga = $_POST['t3'];
$gambar = $_FILES['t4']['name'];
$alamat = $_FILES['t4']['tmp_name'];
mysql_query("insert into barang values('$id','$nabar','$harga','$gambar')");
move_uploaded_file($alamat,"gambar/".$gambar); //gunakan titik jika tidak....
?>
Klik <a href="tampil8x.php">Disini</a>Kembali
ket => //gunakan titik jika tidak maka error //move_uploaded_file() expects exactly 2 parameters, 3 given
tampil8x.php
<?php
mysql_connect("localhost","root","");
mysql_select_db("inputx");
$a = mysql_query("select * from barang");
while($data = mysql_fetch_array($a))
{
echo "<img src='gambar/".$data[gambar]." ' width ="200px" height="300px">"."<br>";
echo "ID Barang = ".$data[idbarang]."<br>";
echo "Nabar = ".$data[nabar]."<br>";
echo "Harga = ".$data[harga]."<br>";
}
?>
Pertemuan 9
$_GET
File Click here
Buatlah database : dbecom9 dan table
tblProduk
kode vc 8
nabar vc 20
harga int 15
tblsementara
kode vc 10
nabar vc 10
harga int 10
jlh int 5
Tampil.php
<h3><center>Daftar</center></h3><hr>
<table border=1 width='70%'>
<tr bgcolor="cyan">
<th>No</th>
<th>Kode barang</th>
<th>Nama barang</th>
<th>Harga barang</th>
<th>Aksi</th>
</tr>
<?php
mysql_connect("localhost","root","");
mysql_select_db("dbecom9");
$no=0;
$ambil = mysql_query("select * from tblproduk");
while($data = mysql_fetch_array($ambil)){
$no++;
?>
<tr align="center" bgcolor="lightblue">
<td><?= $no?></td>
<td><?= $data[0]?></td>
<td><?= $data[1]?></td>
<td><?= $data[2]?></td>
<td><a href="formPesan.php?kobar=<?= $data[0]?>&nabar=<?= $data[1]?>&harga=<?= $data[2]?>">Pesan</a></td>
</tr>
<?php }?>
</table>
Frompesan.php
<form action="prosesSimpan.php" method="post">
<table>
<tr>
<td>Kode Barang</td>
<td><input type="text" name="t1" value="<?php echo $_GET['kobar']?>"></td>
</tr>
<tr>
<td>Nama Barang</td>
<td><input type="text" name="t2" value="<?php echo $_GET['nabar']?>"></td>
</tr>
<tr>
<td>Harga</td>
<td><input type="text" name="t3" value="<?php echo $_GET['harga']?>"></td>
</tr>
<tr>
<td>Jumlah</td>
<td><input type="text" name="t4" ></td>
</tr>
<tr>
<td colspan="2" align="center">
<button type="submit">Pesan</button>
<button type="">Batal</button>
</td>
</tr>
</table>
</form>
ProsesSimpan.php
<?php
mysql_connect("localhost","root","");
mysql_select_db("dbecom9");
$kode = $_POST['t1'];
$nabar = $_POST['t2'];
$harga = $_POST['t3'];
$jlh = $_POST['t4'];
mysql_query("insert into tblsementara values('$kode','$nabar','$harga','$jlh');");
?>
<meta http-equiv="refresh" content="2;tampil.php">
Pertemuan 10
Menampilkan data dari 3 table
word
Click here
$ambil = mysql_query("select tbl_pesan.tgl_pesan,tbl_pelanggan.nama,
tbl_pelanggan.email,tbl_pelanggan.alamat,tbl_pelanggan.nohp,tbl_produk.id_produk,
tbl_produk.nama_produk,tbl_pesan.harga,
tbl_pesan.jumlah,(tbl_pesan.harga*tbl_pesan.jumlah) as total From tbl_pelanggan,tbl_produk,tbl_pesan
where tbl_pelanggan.email = tbl_pesan.email and tbl_produk.id_produk = tbl_pesan.id_produk");
Pertemuan 11
Update Data
Word Click here
Pertemuan 12
Hapus Data
Click here
mysql_query(Delete from orderproduk where idorder='$idorder'");
Pertemuan 13
Membuat FPDF
File dan Download Fpdf17
Click here
Fpdf17
http://www.fpdf.org/en/download.php
barang.php
<?php
mysql_connect("localhost","root","");
mysql_select_db("dblapbarang")or die(mysql_error());
require('fpdf17/fpdf.php');
//Menampilkan data dari tabel di database
$tampung=mysql_query("SELECT * FROM Tbltoko") or die(mysql_error());
//Inisiasi untuk membuat header kolom
$k_kode = "";$k_nabar = "";$k_jenis = "";$k_harga = "";$k_jumlah = "";
//MEMBUAT FILE KOLOM
while($row = mysql_fetch_array($tampung))
{
$kode = $row["kode"];$nabar = $row["nabar"];$jenis = $row["jenis"];
$harga = $row["harga"];$jumlah = $row["jumlah"];
$k_kode = $k_kode.$kode."\n";$k_nabar = $k_nabar.$nabar."\n";
$k_jenis = $k_jenis.$jenis."\n";$k_harga = $k_harga.$harga."\n";
$k_jumlah = $k_jumlah.$jumlah."\n";
//Create a new PDF file
$pdf = new FPDF('P','mm',array(210,297));
$pdf->AddPage();
//MEMBUAT JUDUL
$pdf->SetFont('Arial','B',13);
$pdf->Cell(80);
$pdf->Cell(30,10,'LAPORAN DATA BARANG',0,0,'C');
$pdf->Ln();
$pdf->Cell(80);
$pdf->Cell(30,10,'USAHA KREATIF MAHASISWA MEDICOM',0,0,'C');
$pdf->Ln();
}
//MENENTUKAN POSISI FIELD
$posisinamafield = 30;
//First create each Field Name
//Gray color filling each Field Name box
$pdf->SetFillColor(110,180,230);
//Bold Font for Field Name
$pdf->SetFont('Arial','B',10);
$pdf->SetY($posisinamafield);
$pdf->SetX(50);
$pdf->Cell(25,8,'kode',1,0,'C',1);
$pdf->SetX(75);
$pdf->Cell(25,8,'nabar',1,0,'C',1);
$pdf->SetX(100);
$pdf->Cell(25,8,'jenis ',1,0,'C',1);
$pdf->SetX(125);
$pdf->Cell(25,8,'harga',1,0,'C',1);
$pdf->SetX(150);
$pdf->Cell(25,8,'jumlah',1,0,'C',1);
$pdf->Ln();
//Table position, under Fields Name
$Y_Table_Position = 38;
//Now show the columns
$pdf->SetFont('Arial','',10);
$pdf->SetY($Y_Table_Position);$pdf->SetX(50);
$pdf->MultiCell(25,6,$k_kode,1,'C');
$pdf->SetY($Y_Table_Position);$pdf->SetX(75);
$pdf->MultiCell(25,6,$k_nabar,1,'L');
$pdf->SetY($Y_Table_Position);$pdf->SetX(100);
$pdf->MultiCell(25,6,$k_jenis,1,'C');
$pdf->SetY($Y_Table_Position);$pdf->SetX(125);
$pdf->MultiCell(25,6,$k_harga,1,'C');
$pdf->SetY($Y_Table_Position);$pdf->SetX(150);
$pdf->MultiCell(25,6,$k_jumlah,1,'C');
$pdf->Output();?>
Ecom 14
Menampilkan Data print preview
File word
Click here
ecom14.php
<?php
mysql_connect("localhost","root","");
mysql_select_db("DBToko14");
require('fpdf17/fpdf.php');
//Menampilkan data dari tabel di database
$tampung=mysql_query("SELECT * FROM Tblbarang,Tblcustomer,orderan
where Tblbarang.kode=orderan.idorderan and orderan.idpel=TblCustomer.idpel") or die(mysql_error());
//Inisiasi untuk membuat header kolom
$k_id_order="";$k_tgl="";$k_id_pelanggan="";$k_nama_pelanggan="";
$k_kode = "";$k_nabar = "";$k_harga =
"";$k_jlh_order="";
//MEMBUAT FILE KOLOM
while($row = mysql_fetch_array($tampung))
{
$id_order=$row["idorderan"];$tgl=$row["tglorderan"];$id_pelanggan=$row["idpel"];$nama_pelanggan=$row["napel"];
$kode = $row["kode"];$nabar =
$row["nabar"];$harga = $row["harga"];
$jlh_order=$row["jlh"];
$k_id_order =
$k_id_order.$id_order."\n";
$k_tgl = $k_tgl.$tgl."\n";
$k_id_pelanggan =
$k_id_pelanggan.$id_pelanggan."\n";
$k_nama_pelanggan=
$k_nama_pelanggan.$nama_pelanggan."\n
";
$k_kode =
$k_kode.$kode."\n";$k_nabar =
$k_nabar.$nabar."\n";
$k_harga = $k_harga.$harga."\n";
$k_jlh_order=
$k_jlh_order.$jlh_order."\n";
//Create a new PDF file
$pdf = new
FPDF('P','mm',array(210,297));
$pdf->AddPage();
//MEMBUAT JUDUL
$pdf->SetFont('Arial','B',13);
$pdf->Cell(80);
$pdf->Cell(30,10,'LAPORAN DATA
PEMESANAN BARANG',0,0,'C');
$pdf->Ln();
$pdf->Cell(80);
$pdf->Cell(30,10,'USAHA KREATIF MAHASISWA MEDICOM',0,0,'C');
$pdf->Ln();
}
//MENENTUKAN POSISI FIELD
$posisinamafield = 30;
//First create each Field Name
//Gray color filling each Field Name box
$pdf->SetFillColor(110,180,230);
//Bold Font for Field Name
$pdf->SetFont('Arial','B',8);
$pdf->SetY($posisinamafield);
$pdf->SetX(10);
$pdf->Cell(25,8,'id order',1,0,'C',1);
$pdf->SetX(35);
$pdf->Cell(25,8,'tgl order',1,0,'C',1);
$pdf->SetX(60);
$pdf->Cell(25,8,'id pelanggan',1,0,'C',1);
$pdf->SetX(85);
$pdf->Cell(25,8,'nama',1,0,'C',1);
$pdf->SetX(110);
$pdf->Cell(25,8,'kode',1,0,'C',1);
$pdf->SetX(135);
$pdf->Cell(25,8,'nama barang',1,0,'C',1);
$pdf->SetX(160);
$pdf->Cell(25,8,'harga',1,0,'C',1);
$pdf->SetX(185);
$pdf->Cell(20,8,'jlh order',1,0,'C',1);
$pdf->Ln();
//Table position, under Fields Name
$Y = 38;
//Now show the columns
$pdf->SetFont('Arial','',8);
$pdf->SetY($Y);$pdf->SetX(10);
$pdf->MultiCell(25,6,$k_id_order,1,'C');
$pdf->SetY($Y);$pdf->SetX(35);
$pdf->MultiCell(25,6,$k_tgl,1,'L');
$pdf->SetY($Y);$pdf->SetX(60);
$pdf->MultiCell(25,6,$k_id_pelanggan,1,'C');
$pdf->SetY($Y);$pdf->SetX(85);
$pdf->MultiCell(25,3,$k_nama_pelanggan,1,'C'
);
$pdf->SetY($Y);$pdf->SetX(110);
$pdf->MultiCell(25,6,$k_kode,1,'C');
$pdf->SetY($Y);$pdf->SetX(135);
$pdf->MultiCell(25,6,$k_nabar,1,'C');
$pdf->SetY($Y);$pdf->SetX(160);
$pdf->MultiCell(25,6,$k_harga,1,'C');
$pdf->SetY($Y);$pdf->SetX(185);
$pdf->MultiCell(20,6,$k_jlh_order,1,'C');
$pdf->Output();?>
Semester 6
Reviewed by Leo
on
00:34
Rating:
No comments