mysql -h 192.168.0.64 -u 12ax-yy -p
1234
use db12ax_yy;
create table buku(id char(3) not null auto_increment, nama varchar(20), jeniskel set('L','P'), buku varchar(10), jumlah int(2), bayar int(8), primary key(id));
insert into buku(nama, jeniskel, buku, jumlah, bayar) values('Dunu','L','Komik','10','56000'), ('Fenny','P','Novel','30','47000'), ('Verena','P','Pelajaran','1','3800');
a. select nama,jumlah from buku order by jumlah desc;
b. update buku set nama='Reni' where nama='Fenny';
c. insert into buku(nama,jeniskel,jumlah,bayar) values('Tompel','L',Komik','10','25000');
d. select id,nama where buku='Pelajaran';
e. select buku,bayar from buku;
delete from buku where bayar<10000;
TENTANG POLLING
pollingaxyy.htm
<html><body>
<pre>
<form method=post action=inputaxyy.php>
Nama : <input type=text name=nama>
Kelas : <select name=kelas>
<option value=12 IPA 1>12 IPA 1
<option value=12 IPA 2>12 IPA 2
<option value=12 IPA 3>12 IPA 3
<option value=12 IPA 4>12 IPA 4
<option value=12 IPA 5>12 IPA 5
</select>
Rasa ice cream apakah yang paling anda gemari ?
<input type=radio name=rasa value=coklat>coklat
<input type=radio name=rasa value=strawberry>strawberry
<input type=radio name=rasa value=vanila>vanila
<input type=radio name=rasa value=mocca>mocca
<input type=submit value=Polling>
</form>
</pre>
</body>
</html>
inputaxyy.php
<?$nama=$_POST['nama'];
$kelas=$_POST['kelas'];
$rasa=$_POST['rasa'];
mysql_connect("192.168.0.64","12ax-yy","1234");
mysql_select_db("db12ax_yy") or die ("Database tidak ada");
$hasil=mysql_query("insert into ice(nama,kelas,rasa) values('$nama','$kelas','$rasa')");
echo"<a href=hasilpollingaxyy.php>LIHAT HASIL POLLING</a>";
?>
hasilpollingaxyy.php
<?
mysql_connect("192.168.0.64","12ax-yy","1234");
mysql_select_db("db12ax_yy") or die ("Database tidak ada");
$hsl=mysql_query("select from ice where rasa=coklat");
$co=mysql_num_rows($hsl);
$hsl=mysql_query("select from ice where rasa=strawberry");
$sb=mysql_num_rows($hsl);
$hsl=mysql_query("select from ice where rasa=vanila");
$va=mysql_num_rows($hsl);
$hsl=mysql_query("select from ice where rasa=mocca");
$mo=mysql_num_rows($hsl);
$t=$co+$sb+$va+$mo;
echo"Rasa es cream apakah yang paling anda sukai ?<br>";
echo"Hasil Polling :<br>";
$p1=$co/$t*100;
$p2=$sb/$t*100;
$p3=$va/$t*100;
$p4=$mo/$t*100;
echo"Coklat : <img src=blue.jpg width=$p1 height=10>" .$p1. "%<br>";
echo"Strawberry : <img src=green.jpg width=$p2 height=10>" .$p2. "%<br>";
echo"Vanila : <img src=lightblue.jpg width=$p3 height=10>" .$p3. "%<br>";
echo"Mocca : <img src=red.jpg width=$p4 height=10>" .$p4. "%<br>";
echo"<a href=pollinga319.htm>Kembali ke halaman utama</a>";
?>