Menu

Senin, 07 Januari 2019

PHP MYSQL bagian 3 membuat halaman tampil

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body align="center">
 
<?php
include "koneksi.php";
?>

<table border="1" cellpadding="5" cellspacing="0" align="center">
<tr>
  <td bgcolor='#000FFF'>Id</td>
  <td bgcolor='#000FFF'>Nama</td>
  <td bgcolor='#000FFF'>Alamat</td>

</tr>

<?php

$query = mysqli_query($dbconnect, "SELECT * FROM siswa order by id DESC")
   or die (mysqli_error($dbconnect));

//menampilkan JUMLAH BARIS
echo "<br>";
$jumlah=mysqli_num_rows($query);
echo "Jumlah data ada : ".$jumlah;
echo "<br><br>";
//SELESAI MENAMPILKAN JUMLAH

while ($row = mysqli_fetch_array($query)) {
  echo
   "<tr>
    <td align='center' bgcolor='#00FFFF'>{$row['id']}</td>
    <td bgcolor='#00FFFF'>{$row['nama']}</td>
    <td bgcolor='#00FFFF'>{$row['alamat']}</td>
   </tr>\n";
}

?>
</table><br>

</body>
<?
}
?>
</html>

Tidak ada komentar:

Posting Komentar

Komentarlah dengan bijak no Spam