Dismounted, I tried pasting the code into the php page (screenshot) the same place (beneath the START MAIN SCRIPT comment as I believe boofo did (when I looked at his info.php file), is that what u mean, cause its not working for me. I pasted this PHP code at line 37.
PHP Code:
// include MySQL connector function
if (! @include('includes/connection.inc.php')) {
echo 'Sorry, page unavailable';
exit;
}
$conn = dbConnect('query');
// how many rows to show per page
$rowsPerPage = 20;
// by default we show first page
$pageNum = 1;
// if $_GET['page'] defined, use it as page number
if(isset($_GET['page']))
{
$pageNum = $_GET['page'];
}
// counting the offset
$offset = ($pageNum - 1) * $rowsPerPage;
$result = mysql_query("
SELECT Approve, ID, Name, featured_pic
FROM provider
WHERE Approve = '1'
ORDER BY rand()
LIMIT $offset, $rowsPerPage
");
echo "<table width='70%' cellpading=7 border=1 bordercolor='black' rules='rows' align='center'>";
echo "<tr><th width='120px' class='tcat'>Thumbnail</th>";
echo "<th align='left' class='tcat'>Name</th></tr>";
while ($row = mysql_fetch_array($result))
{
if(empty($row['featured_pic'])) {
$thumb_nail = "<img src='/images/ASP_Images/thumbs/default.jpg' border='0' />";
} else {
$thumb_nail = '<img src="'.$row['featured_pic'].'" alt="'.$row['Name'].'" border="0" />';
}
// Build your formatted results here.
print '<tr>';
print '<th><a href="/provider_page.php?ID=' .$row['ID']. '">'.$thumb_nail.'</a></th>';
print '<th align=\'left\'><a href="/provider_page.php?ID='.$row['ID'].'" class="link">'.$row['Name'].'</a></td>';
print "</tr>";
print "\n";
}
echo "</td></tr></table>";
// how many rows we have in database
$query = "SELECT COUNT(ID) AS numrows FROM provider";
$result = mysql_query($query) or die('Error, query failed');
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$numrows = $row['numrows'];
// how many pages we have when using paging?
$maxPage = ceil($numrows/$rowsPerPage);
// print the link to access each page
$self = $_SERVER['PHP_SELF'];
$nav = '';
for($page = 1; $page <= $maxPage; $page++)
{
if ($page == $pageNum)
{
$nav .= " $page "; // no need to create a link to current page
}
else
{
$nav .= " <a href=\"$self?page=$page\">$page</a> ";
}
}
// creating previous and next link
// plus the link to go straight to
// the first and last page
if ($pageNum > 1)
{
$page = $pageNum - 1;
$prev = " <a href=\"$self?page=$page\">[Prev]</a> ";
$first = " <a href=\"$self?page=1\">[First Page]</a> ";
}
else
{
$prev = ' '; // we're on page one, don't print previous link
$first = ' '; // nor the first page link
}
if ($pageNum < $maxPage)
{
$page = $pageNum + 1;
$next = " <a href=\"$self?page=$page\">[Next]</a> ";
$last = " <a href=\"$self?page=$maxPage\">[Last Page]</a> ";
}
else
{
$next = ' '; // we're on the last page, don't print next link
$last = ' '; // nor the last page link
}
// print the navigation link
echo "<p style='text-align:center'>".$first . $prev . $nav . $next . $last."</p>";