.:Biasakan Menggunakan Software Legal, Jangan Bajakan.:. " Home | The Official fnfCreator BLOG: Modul PHP MySql Lanjutan
....

Sabtu, 15 November 2008

Modul PHP MySql Lanjutan

1. Simpan dalam FIle mycss.css

=style type ="text/css">
table { border-collapse: collapse; border: 1px solid #C0C0C0; }
td { border: 1px solid #C0C0C0; text-align: left; }
=/style>


2. Simpan dalam File lihatmahasiswa.php

^?php
include("mycss.css");
include("koneksi.php");

mysql_select_db("akademik");

$query=mysql_query("select * from mahasiswa") or die(mysql_error());

$baris_data=mysql_fetch_array($query);
echo "^tr>";

echo "^td width=950 valign=top>^h3 align=center>DATA MAHASISWA^/h3>";

$jmlmhs=mysql_num_rows($query);
echo "^table border=1 align=center>";

echo "^tr bgcolor=green align=center>";

echo "^td>^b>^font color=lime size = 2>Nomor^/font>";
echo "^td>^b>^font color=lime size = 2>NPM^/font>";

echo "^td>^b>^font color=lime size = 2>Nama Mahasiswa^/font>";

echo "^td>^b>^font color=lime size = 2>Program Studi^/font>";

echo "^td>^b>^font color=lime size = 2>Jenjang^/font>";

echo "^td>^b>^font color=lime size = 2>Tahun Masuk^/font> ^/b>";
echo "^td>^b>^font color=lime size = 2>Alamat^/font> ^/b>";

echo "^/tr>";
for ($i = 1; $i ^ $jmlmhs; $i++) {


$baris_data = mysql_fetch_array($query);
echo "^tr>";

echo "^td align = center bgcolor = lime>^font color = blue size = 1 >" .$i. ".^/td>";

echo "^td bgcolor = lime> ^font color = blue size = 1 > $baris_data[npm]^/td>";

echo "^td bgcolor = lime> ^font color = blue size = 1> $baris_data[nama]^/td>";
echo "^td align = center bgcolor = lime> ^font color = blue size = 1> $baris_data[prodi]^/td>";

echo "^td align = center bgcolor = lime> ^font color = blue size = 1> $baris_data[jenjang]^/td>";

echo "^td bgcolor = lime> ^font color = blue size = 1> $baris_data[tahun_masuk]^/td>";
echo "^td bgcolor = lime> ^font color = blue size = 1> $baris_data[alamat]^/td>";

echo "^/tr>";
}
echo "^/table>";
echo "^br>";


echo "^table>";
echo "^tr align = center>";

echo "^td bgcolor=white colspan=3>^font color=blue>Jumlah Total Mahasiswa = ^/font>";

$total = $jmlmhs - 1;
echo "^td bgcolor=white width = 20 align = left>^b>^font color=blue size = 2>$total^/font> ^/td>";

echo "^td bgcolor=white width = 20 align = left>^b>^font color=blue size = 2> Orang ^/font> ^/td>";

echo "^td> ";
echo "^td> ";

echo "^/tr>";
echo '^a href = "tambahmahasiswa.php"> Kembali ke form entri Data ^/a>';


echo "^/table>";

?>

Tidak ada komentar: