<?php
$db_host = "localhost";
$db_name = "test_codez";
$db_user = "root";
$db_pass = "";
$db = mysqli_connect ($db_host, $db_user, $db_pass, $db_name) or die ("Невозможно подключиться к БД");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css" />
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js?sd"></script>
<script src="https://cdn.datatables.net/plug-ins/1.10.15/i18n/Russian.json?213"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#test').DataTable();
});
</script>
</head>
<body>
<table id="test" class="display" style="width:100%">
<thead>
<tr>
<th>Alphabetic</th>
<th>Numeric</th>
<th>Date</th>
<th>Unsortable</th>
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT * FROM test_table2 ";
$sql = mysqli_query($db, $sql);
while ($result = mysqli_fetch_array($sql))
{
echo " <tr><td>".$result['Alphabetic']."</td><td>".$result['Numeriс']."</td><td>".$result['Date']."</td><td>".$result['Unsortable']."</td></tr>\n";
}
?>
</tbody>
</table>
</body>
</html>
<?php
$db_host = "127.0.0.1";
$db_name = "test_codez";
$db_user = "root";
$db_pass = "";
$db = mysqli_connect ($db_host, $db_user, $db_pass, $db_name) or die ("Невозможно подключиться к БД");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css" />
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/plug-ins/1.10.15/i18n/Russian.json"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#test').DataTable();
});
</script>
</head>
<body>
<table id="test">
<tr>
<th>Alphabetic</th>
<th>Numeric</th>
<th>Date</th>
<th>Unsortable</th>
</tr>
<?php
$sql = "SELECT * FROM test_table2 ";
$sql = mysqli_query($db, $sql);
while ($result = mysqli_fetch_array($sql))
{
echo "<tr><td>".$result['Alphabetic']."</td><td>".$result['Numeriс']."</td><td>".$result['Date']."</td><td>".$result['Unsortable']."</td></tr>";
}
?>
</table>
</body>
</html>