Perintah SQL
1 | <em>CREATE TABLE `school`.`jurusan` ( |
2 | `kd_jur` VARCHAR( 15 ) NULL , |
3 | `jurusan` VARCHAR( 50 ) NULL |
Atau field - field yang harus dibuat
Field | Length / Value | Keterangan |
kd_jur | varchar(15) | Null |
jurusan | varchar(50) | Null |
Nama Tabel : pendaftar
Perintah SQL
1 | CREATE TABLE `school`.`pendaftar` ( |
2 | `no` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , |
3 | `kd_jur` VARCHAR( 15 ) NULL , |
4 | `nama` VARCHAR( 50 ) NULL , |
5 | `jenkel` VARCHAR( 50 ) NULL , |
6 | `alamat` VARCHAR( 255 ) NULL |
Atau
Field - field yang harus dibuat
Field
|
Length / Value
|
Keterangan
|
no | int (11) | Auto_Increment, Not Null |
kd_jur | varchar(15) | Null |
nama | varchar(50) | Null |
jenkel | varchar(50) | Null |
Alamat | varchar(255) | Null |
jika sudah silahkan ketik script di bawah ini :
####### koneksi.php #######
2 | $koneksi=mysql_connect( "localhost" , "root" , "" ); |
3 | mysql_select_db( "school" ,$koneksi); |
######## index.php ########
07 | <meta http-equiv= "Content-Type" content= "text/html; charset=iso-8859-1" /> |
08 | <title>PENCARIAN SEDERHANA</title> |
09 | <style type= "text/css" > |
12 | font-family: Verdana, Arial, Helvetica, sans-serif; |
16 | background-color: #0C6D9C; |
21 | <table align= "center" bgcolor= "#11A2E8" border= "0" cellpadding= "3" cellspacing= "3" width= "674" > |
23 | <td bgcolor= "#D6EFFC" ><p align= "center" ><strong>PENCARIAN SEDERHANA BERDASARKAN NAMA</strong></p> |
24 | <form id= "form1" name= "form1" method= "post" action= "" > |
26 | <input name= "cari" id= "cari" size= "50" type= "text" > |
27 | <input name= "Submit" value= "Pencarian" type= "submit" > |
33 | ?><p align= "center" ><strong>HASIL PENCARIAN</strong></p> |
35 | $lispendaftar=mysql_query( "SELECT * FROM pendaftar WHERE nama LIKE '%$cari%'" ); |
36 | $totalseluruhpendaftar=mysql_num_rows($lispendaftar); |
37 | if ($totalseluruhpendaftar== '0' ){ |
38 | echo "</p><center><blink>Maaf Data yang anda cari tidak ada di dalam database</blink></center>" ; |
40 | echo "Jumlah Seluruh Data yang ditemukan Adalah <b>$totalseluruhpendaftar</b> Data" ; |
45 | while ($lispendaftar1=mysql_fetch_array($lispendaftar)){ |
51 | <table align= "center" bgcolor= "#D78EFA" border= "0" cellpadding= "3" cellspacing= "1" width= "98%" > |
53 | <td align= "center" bgcolor= "#F0D7FD" valign= "middle" ><strong>KD Jurusan </strong></td> |
54 | <td align= "center" bgcolor= "#F0D7FD" valign= "middle" ><strong>Nama</strong></td> |
55 | <td align= "center" bgcolor= "#F0D7FD" valign= "middle" ><strong>Jenis Kelamin </strong></td> |
56 | <td align= "center" bgcolor= "#F0D7FD" valign= "middle" ><strong>Alamat</strong></td> |
58 | <td bgcolor= "#FFFFFF" ><?=$lispendaftar1[kd_jur]?></td> |
59 | <td bgcolor= "#FFFFFF" ><?=$lispendaftar1[nama]?></td> |
60 | <td bgcolor= "#FFFFFF" ><?=$lispendaftar1[jenkel]?></td> |
61 | <td bgcolor= "#FFFFFF" ><?=$lispendaftar1[alamat]?></td> |
Label: php dan mysql
0 Komentar:
Posting Komentar
Berlangganan Posting Komentar [Atom]
<< Beranda