Please use code tags to display the codes neatly
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
$hostname_doktor = 'localhost';
$username_doktor = 'root';
$password_doktor = '';
$conn = mysql_connect($hostname_doktor, $username_doktor,$password_doktor) or die ('Error connecting to mysql');
$database_doktor = 'doktor';
mysql_select_db($database_doktor);
$limit = 10;
if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=5; };
$start_from = ($page-5) * $limit;
$negara=(isset($_POST['negara']));
$IdWarga=(isset($_POST['IdWarga']));
$query = ("SELECT * FROM warganegara") or die (mysql_error());
$result = mysql_query ($query);
?>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>title</th>
<th>body</th>
</tr>
<thead>
<tbody>
<?php
while ($row = mysql_fetch_assoc($result)) {
?>
<tr>
<td><?php echo $row['IdWarga']; ?></td>
<td><?php echo $row['negara']; ?></td>
</tr>
<?php
};
?>
</tbody>
</table>
<?php
$query = "SELECT COUNT(negara) FROM warganegara";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
$total_records = $row[0];
$total_pages = ceil($total_records / $limit);
$pagLink = "<div class='pagination'>";
for ($i=5; $i<=$total_pages; $i++) {
$pagLink .= "<a href='add_warganewAdmin.php?page=".$i."'>".$i."</a>";
};
echo $pagLink . "</div>";
?>
</body>
</html>