Created
March 13, 2015 09:03
-
-
Save Aziz-Rahman/98919ef2fa4f1a7660ff to your computer and use it in GitHub Desktop.
Tb warna - warni
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" ); | |
$baris = 1; | |
echo "<table width=\"400\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#ffffff\">"; | |
echo "<tr bgcolor=\"#00CC00\">"; echo "<th>NIM</th>"; | |
echo "<th>Nama</th>"; | |
echo "<th>Alamat</th>"; | |
echo "</tr>"; | |
$myquery = "select nim,nama,alamat from tb_mahasiswa"; | |
$daftarsiswa = mysql_query( $myquery ) or die ( mysql_error() ); | |
while( $dataku=mysql_fetch_object( $daftarsiswa ) ){ | |
$warna = ( $baris% 2 == 1 ) ? "#cccccc" : "#99FF99"; | |
echo "<tr bgcolor=\"".$warna."\">"; | |
echo "<td>".$dataku->nim."</td>"; | |
echo "<td>".$dataku->nama."</td>"; | |
echo "<td>".$dataku->alamat."</td>"; | |
echo "</tr>"; | |
$baris++; } | |
echo "</table>"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment