hi all
i want to highlight current page in pagination.
My pagination is working fine but i m not able to apply styles in my pagination numbers.
its not accepting any style. is there any other way to apply class.
This is stylesheet
<style type="text/css">
a.paging:link {background: #FFCC00; text-decoration: none; color:#FFFFFF}
a.paging:visited {background: black; text-decoration: none; color:#FFFFFF}
a.paging:active {background: #FFCC00; text-decoration: none; color:#FFFFFF}
a.paging:hover {background: #FFCC00; font-weight:bold; color:#FFFFFF}
</style>
<style type="text/css">
a.pagingCurrent:link {background: #FF0000; text-decoration: none; color:#FFFFFF}
a.pagingCurrent:visited {background: black; text-decoration: none; color:#FFFFFF}
a.pagingCurrent:active {background: #FF0000; text-decoration: none; color:#FFFFFF}
a.pagingCurrent:hover {background: #FF0000; font-weight:bold; color:#FFFFFF}
</style>
This is pagination
<?php
$dealer_id=$_REQUEST['dealer_id'];
$category_id=$_REQUEST['category_id'];
$sql = "SELECT * FROM product_table where dealer_id=$dealer_id";
$q = mysql_query($sql);
$total_records = mysql_num_rows($q);
$records_per_page = 1;
$total_pages = ceil($total_records / $records_per_page);
$page = intval($_GET['page']);
if ($page < 1 || $page > $total_pages) {
$page = 1;
}
$offset = ($page - 1) * $records_per_page;
$sql = "SELECT * FROM product_table where dealer_id=$dealer_id LIMIT $offset, $records_per_page";
$result=mysql_query($sql);
while($row = mysql_fetch_array($result))
{
$desc = substr($row['detail_description'], 0, 250);
echo "<td valign=top class='des' width=250>". $desc . "</td>";
echo "</tr>";
echo "<tr>";
}
echo "No. of Pages";
for ($i = 1; $i <= $total_pages; $i++)
{
if ($i == $page) {
$class = 'class="pagingCurrent"';
$prepend = 'Page';
}
else
{
$class = 'class="paging"';
$prepend = 'Page';
}
echo "<a href=products-".$dealer_id."-". $category_id. "-". $i. ".html " . $class . ">" . $prepend. $i . "</a>\n";
unset($class, $prepend);
}
?>
vineet