Hey guys,
longtime reader first time poster.
i seem to be having a pagination problem and i think that some fresh eyes are in order
im sure its staring in front of me.......just cant see it
<?php
global $main;
$main->query('upgraded', "SELECT `auctions`.*, `categories`.* FROM `auctions` LEFT JOIN `categories` ON `category_id` = `auction_category_id` WHERE `auction_upgrade_color` = '1' ORDER BY `auction_id` DESC LIMIT {$main->upgraded_auctions_max}");
if (!$main->auth['logged_in']) {
header('Location: ' . SITE_BASE . '/login/');
}
?>
<div class="left">
<? include('php/inc.featured-listings.php'); ?>
</div>
<div class="right">
<?php
#pagination
$sql = "SELECT `auction_id` FROM `auctions` WHERE `auction_user_id` = {$main->auth[user_id]}";
$q = mysql_query($sql);
$page_count = ceil(mysql_num_rows($q) / $main->auctions_per_page);
$current_page = (int) $_GET['current_page'] > 0 && (int) $_GET['current_page'] <= $page_count ? $_GET['current_page'] : 1;
$offset = ($current_page - 1) * $main->auctions_per_page;
$order = in_array($_GET['order'], array('auction_id', 'auction_views', 'auction_title', 'category_name')) ? $_GET['order'] : 'auction_id';
#listings
if (!$_GET['auction_id']):
$title = 'My Current Listings';
#query for newest listings
$sql = "SELECT `auctions`.*, `categories`.*, `users`.* FROM `auctions` LEFT JOIN `categories` ON `category_id` = `auction_category_id` LEFT JOIN `users` ON `user_id` = `auction_user_id` WHERE `auction_user_id` = {$main->auth[user_id]} GROUP BY `$order` ORDER BY `$order` DESC LIMIT $offset, {$main->auctions_per_page}";
$q = mysql_query($sql);
?>
<table cellpadding="0" cellspacing="0" class="listings" style="width: 703px;">
<tr class="header">
<td colspan="5"><h2><?php echo $title; ?></h2></td>
</tr>
<tr class="title">
<td width="50%" class="lborder">Listing Title</td>
<td width="15%">Created In</td>
<td width="15%">Created By</td>
<td width="15%">Listed On</td>
<td width="5%">Views</td>
</tr>
<?php while ($r = mysql_fetch_assoc($q)): ?>
<tr class="listing<?php echo $r['auction_upgrade_color'] == '1' ? ' orange' : ''; ?>">
<td class="listing-title"><a href="/auction/<?php echo $r['auction_id']; ?>-<?php echo niceurls($r['auction_title']); ?>.html"><?php echo $r['auction_title']; ?></a></td>
<td><a href="/category/<?php echo $r['category_url']; ?>/"><?php echo $r['category_name']; ?></a></td>
<td><a href="/user/<?php echo $r['user_id']; ?>/"><?php echo $r['user_name']; ?></a></td>
<td><?php echo howlongago($r['auction_time_listed']); ?></td>
<td><?php echo number_format($r['auction_views']); ?></td>
</tr>
<?php endwhile; ?>
</table>
<div class="pagination">
<?php for ($i = 1; $i <= $page_count; $i++): ?>
<a href="./?current_page=<?php echo $i; ?>"<?php echo $i == $current_page ? ' class="current"' : ''; ?>><?php echo $i; ?></a>
<?php endfor; ?>
</div>
<?php endif; ?>
</div>
thanks in advance
and yes i can laugh at myself