I would like to limit the results to 10 and provide links for previous and next pages. I have searched a lot around the page but I am still having a tough time finding something I can use. I understand the basics of it but I don't know if I can make it without 20 errors! haha
Anyway I have the php file and the function library corresponding to the page.
Page PHP:
<?php
$page_title = "Erie Scene Home Page";
require("listingsfunc.php");
if ($_GET['id'] != "") {
dbconnect();
sidemenu($connection);
showsingle($connection);
} if ($_GET['show_all_erie_pa_bars']) {
dbconnect();
showall($connection);
$align = "<div id=\"align\">";
$alignclose = "</div>";
} else if (!$_GET['id']) {
dbconnect();
eventreg($connection);
sidemenu($connection);
$align = "<div id=\"align\">";
$alignclose = "</div>";
}
pagecount($page_title);
// assume $text has been populated with the desired text from the DB
$details = preg_replace('/\w(erie|bands?|events?)\w/i', "<strong>$1</strong>", $details);
mysql_close($connection);
?>
Func File: This is what I want to limit by 10 provide links going back 10 and forth 10
function eventreg($connection) {
global $display_block;
$table_name = "events";
$sql = "SELECT date, bar, DATE_FORMAT(`updated`,'%M-%d-%Y') updated, details, map_url FROM $table_name WHERE `date` BETWEEN DATE_SUB(CURDATE(), INTERVAL 6 DAY) and DATE_ADD(CURDATE(), INTERVAL 30 DAY) ORDER BY 'bar'";
$result = mysql_query($sql)
or die (mysql_error());
$display_block ="";
//While loop will create an array called $row
while ($row = mysql_fetch_array($result)) {
// get individual elements from events
$date = ($row['date']);
$bar = ($row['bar']);
$updated = ($row['updated']);
$details = ($row['details']);
$map_url = ($row['map_url']);
// assume $text has been populated with the desired text from the DB
$details = preg_replace('/\b(erie|bands?|events?|bars?|drinks?|dj?|shows?)\b/i', "<strong>$1</strong>", $details);
$display_block .= "
<h4>$bar <span class=\"date\"> added on:$updated</span></h4>
<p>$details</p>
<div align=\"right\"><span class=\"map\"><a href=\"$map_url\" target=\"_blank\" title=\"Erie Bar :: $bar\">Get Directions</a></span></div>
";
}
}
This is probally gonna be real easy, but I want to be absolutely sure it is right.