There is a code. It performs a query from the database for all entries with pagination.
include('config.php'); $lim = "9"; @$page = $_GET['page']; $res = mysql_query("SELECT COUNT(*) FROM music"); $row = mysql_fetch_array($res); $posts = $row[0]; $str = ceil($posts / $lim); if (empty($page) or $page < 0) $page = 1; if ($page > $str) $page = $str; $start = $page * $lim - $lim; $result = mysql_query("SELECT * FROM music ORDER BY date DESC LIMIT $start, $lim"); $myrow = mysql_fetch_array($result); $artist = $myrow['artist']; do { printf(" <div id='mp3'> <h5 style='margin: 20px;'>" . $myrow['artist'] . " - " . $myrow['title'] . "<a href='" . $myrow['link'] . "'>Скачать</a></h5> </div> "); } while ($myrow = mysql_fetch_array($result)); echo '<div id="navi_n"><a href=?page=' . ($page - 1) . '>Назад</a> '; $i = 1; while ($i <= $str) { if ($i == $page) { echo '<strong><a href=?page=' . $i . '>' . $i . '</a></strong> '; } else { echo '<a href=?page=' . $i . '>' . $i . '</a> '; } $i = $i + 1; } echo ' <a href=?page=' . ($page + 1) . '>Вперед</a></div>'; I can not figure out how to make the artist field be a link, when clicked, the selection from the database was performed only by its name? It is also necessary to make a selection of records by month, i.e. the user clicks on "January" they are shown all the records for January, of course there is a date field. Already the third day I'm worried: (
update1: I do not know whose lesson :) Yes, an error. Just starting to recognize php, so there is no reason to smile: D