Senin, 10 September 2012

0 Database ; PHP & MYSQL

MEMUNCULKAN DATABASE MYSQL DALAM BENTUK TABLE MENGGUNAKAN PHP..


<?php
include "config.php";
$no = 1;
$sql = "SELECT * from stasiun";
$hasil = mysql_query($sql) or die (mysql_error());
$cekdata = mysql_num_rows($hasil);
if ($hasil==0) {
    echo "data tidak ada";
    }
    else {
    echo "<table border='1' cellspacing=0 cellpadding=0 width=80%>
<tr>
<th scope=col> <abbr=No class=nobg>No</th>
<th scope=col> NAMA_STASIUN RADIO </th>
<th scope=col> ALAMAT </th>
<th scope=col> FREKUENSI</th>
</tr>";

while ($stasiun = mysql_fetch_array($hasil))
    {
    echo "<tr>";
    echo "<td scope=row class=spec align=center>".$no++."</td>";
    echo "<td>" . $stasiun['Nama'] . "</td>";
    echo "<td>" . $stasiun['Alamat'] . "</td>";
    echo "<td>" . $stasiun['Frekuensi'] . "</td>";
    echo "</tr>";
    }
echo "</table>";

}
mysql_close();
?>

0 komentar:

Posting Komentar

 

My Lesson Copyright © 2011 - |- Template created by O Pregador - |- Powered by Blogger Templates