Code:
[Link]
<?php include_once("[Link]"); ?>
<link href="[Link]" rel="stylesheet" type="text/css" />
<tr>
<td align="left" valign="top" style="padding-right:8px; padding-
left:8px;"><table width="100%" border="0" align="center"
cellpadding="0" cellspacing=" 0">
<tr>
<td width="22%" height="495" align="left" valign="top"><?php
include_once("[Link]"); ?></td>
<td width="53%" align="left" valign="top"><table width="99%"
border="0" align="center" cellpadding="0" cellspacing=" 0">
<tr>
<td height="45" colspan="3" align="left" valign="middle"
style="padding-left:10px;" class="header12">Featured Products</td>
</tr>
<?php $tbl_name="products"; //your table name
// How many adjacent pages should be shown on each side?
$adjacents = 2;
$query = "SELECT COUNT(*) as num from
$tbl_name where feature=1 and parent_id=0";
$total_pages = mysql_fetch_array(mysql_query($query));
$total_pages = $total_pages[num];
/* Setup vars for query. */
$targetpage = "[Link]"; //your file name (the name of this file)
$limit = 12;
/*echo $_GET['page'];
exit(); */ //how many
items to show per page
$page = $_GET['page'];
if($page)
$start = ($page - 1) * $limit; //first item to display
on this page
else
$start = 0;
//if no page var is given, set start to 0
/* Get data. */
$pro = "SELECT * FROM $tbl_name where feature=1 and parent_id=0
order by pid DESC LIMIT $start, $limit";
$prores = mysql_query($pro);
/* Setup page vars for display. */
if ($page == 0) $page = 1; //if no page var
is given, default to 1.
$prev = $page - 1;
//previous page is page - 1
$next = $page + 1; //next
page is page + 1
$lastpage = ceil($total_pages/$limit); //lastpage is = total
pages / items per page, rounded up.
$lpm1 = $lastpage - 1; //last
page minus 1
/*
Now we apply our rules and draw the pagination object.
We're actually saving the code to a variable in case we want to
draw it more than once.
*/
$pagination = "";
if($lastpage > 1)
$pagination .= "<div class=\"pagination\">";
//previous button
if ($page > 1)
$pagination.= "<a href=\"$targetpage?page=$prev\">«
previous</a>";
else
$pagination.= "<span class=\"disabled\">«
previous</span>";
//pages
if ($lastpage < 7 + ($adjacents * 2)) //not enough pages to bother
breaking it up
for ($counter = 1; $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "<span
class=\"current\">$counter</span>";
else
$pagination.= "<a
href=\"$targetpage?page=$counter\">$counter</a>";
elseif($lastpage > 5 + ($adjacents * 2)) //enough pages to hide
some
//close to beginning; only hide later pages
if($page < 1 + ($adjacents * 2))
for ($counter = 1; $counter < 4 + ($adjacents * 2);
$counter++)
if ($counter == $page)
$pagination.= "<span
class=\"current\">$counter</span>";
else
$pagination.= "<a
href=\"$targetpage?page=$counter\">$counter</a>";
$pagination.= "...";
$pagination.= "<a
href=\"$targetpage?page=$lpm1\">$lpm1</a>";
$pagination.= "<a
href=\"$targetpage?page=$lastpage\">$lastpage</a>";
//in middle; hide some front and some back
elseif($lastpage - ($adjacents * 2) > $page && $page >
($adjacents * 2))
$pagination.= "<a
href=\"$targetpage?page=1\">1</a>";
$pagination.= "<a
href=\"$targetpage?page=2\">2</a>";
$pagination.= "...";
for ($counter = $page - $adjacents; $counter <=
$page + $adjacents; $counter++)
if ($counter == $page)
$pagination.= "<span
class=\"current\">$counter</span>";
else
$pagination.= "<a
href=\"$targetpage?page=$counter\">$counter</a>";
$pagination.= "...";
$pagination.= "<a
href=\"$targetpage?page=$lpm1\">$lpm1</a>";
$pagination.= "<a
href=\"$targetpage?page=$lastpage\">$lastpage</a>";
//close to end; only hide early pages
else
$pagination.= "<a
href=\"$targetpage?page=1\">1</a>";
$pagination.= "<a
href=\"$targetpage?page=2\">2</a>";
$pagination.= "...";
for ($counter = $lastpage - (2 + ($adjacents * 2));
$counter <= $lastpage; $counter++)
if ($counter == $page)
$pagination.= "<span
class=\"current\">$counter</span>";
else
$pagination.= "<a
href=\"$targetpage?page=$counter\">$counter</a>";
//next button
if ($page < $counter - 1)
$pagination.= "<a href=\"$targetpage?page=$next\">next
»</a>";
else
$pagination.= "<span class=\"disabled\">next »</span>";
$pagination.= "</div>\n";
} if($total_pages<=0)
{ ?>
<tr>
<td align="left" valign="top"> </td>
</tr>
<tr>
<td align="center" valign="top"><strong>There Are No
Featured Products</strong> </td>
</tr>
<tr>
<td align="left" valign="top"> </td>
</tr>
<?php } else {
$cnt=0;
while($prorow=mysql_fetch_array($prores)) {
$cnt++;
if($cnt%1==1)
echo "<tr>";
if($cnt%3==1)
{
echo "</tr><tr><td align=\"right\" colspan=\"3\"> </td></tr><tr>";
?>
<form action="[Link]" name="formno<?php echo
$prorow['pid']; ?>" method="post">
</form>
<td align="left" valign="top"><table width="165" border="0"
align="left" cellpadding="0" cellspacing=" 0">
<tr>
<td align="left" valign="top" style="border:#CCCCCC
solid 1px;"><table width="95%" border="0" align="center"
cellpadding="0" cellspacing=" 0">
<tr>
<td height="20" colspan="2" align="center"
valign="middle"><a href="[Link]?productid=<?php echo
$prorow['pid']; ?>&category_id=<?php echo $prorow['cat_id']; ?>"
class="menu7"> <?php echo $prorow['pname'] ?></a></td>
</tr>
<tr>
<td colspan="2" align="center" valign="middle"><img
src="images/products/detail/<?php echo $prorow['pid']; ?>.jpg"
width="100" height="137" /></td>
</tr>
<tr>
<td height="25" align="center" valign="middle"
class="text_2" colspan="2"> </td>
</tr>
<tr>
<td height="25" align="center" valign="middle"
class="text_2" colspan="2"><a href="[Link]?productid=<?php
echo $prorow['pid']; ?>&category_id=<?php echo $prorow['cat_id'];
?>"><img src="images/[Link]" width="64" height="21" border="0"
/></a></td>
</tr>
<tr>
<td height="8" colspan="2" align="center"
valign="middle"><input type="hidden" name="prodid" value="<?php
echo $prorow['pid']; ?>" />
<input type="hidden" name="prodprice"
value="<?php echo $prorow['oprice'] ?> " />
<input type="hidden" name="prodname"
value="<?php echo $prorow['pname']; ?>" />
<input id="qty" size="1" name="qty" type="hidden"
value="1" />
</td>
</tr>
</table></td>
</tr>
</table></td>
<?php } }?>
<tr>
<td align="right" colspan="3"> </td>
</tr>
<tr>
<td align="right" colspan="3"><?php=$pagination?></td>
</tr>
</table></td>
<td width="25%" align="left" valign="top"><?php
include_once("[Link]"); ?>
<form name="form1" method="post" action="">
<p> </p>
<p> </p>
</form></td>
</tr>
</table></td>
</tr>
<?php include_once("[Link]"); ?>
[Link]
<?php session_start();
ob_start();
include_once("[Link]");
?>
<link rel="shortcut icon" href="images/[Link]" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "[Link]
[Link]">
<html xmlns="[Link]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-
1" />
<title>Welcome to Furniture Showroom</title>
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #333333;
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
-->
</style>
<link href="[Link]" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/[Link]"></script>
<script>
function searchvalid()
var d=[Link];
if([Link]=="")
alert("Please Enter Keyword For Search");
[Link]();
return false;
return true;
</script>
</head>
<body>
<table width="980" border="0" align="center" cellpadding="0"
cellspacing=" 0">
<tr>
<td height="1034" align="left" valign="top"><table width="100%"
border="0" cellspacing=" 0" cellpadding="0">
<tr>
<td height="70" align="left" valign="middle"><table width="100%"
border="0" cellspacing=" 0" cellpadding="0">
<tr>
<td width="69%" height="110" rowspan="2" align="left"
valign="middle"><img src="images/[Link]" width="640"
height="100" /></td>
<td height="64" colspan="2" align="left" valign="middle"><table
width="60%" border="0" align="center" cellpadding="0" cellspacing="
0">
<tr>
<td width="19%" rowspan="2" align="center"
valign="middle"><img src="images/[Link]" width="13"
height="11" /></td>
<td width="81%" height="25" align="left" valign="middle"
class="spacer"> Shopping Cart:</td>
</tr>
<tr>
<td align="left" valign="top">now in your cart<a
href="[Link]" class="menu1"><strong> <?php echo
$_SESSION['count']; ?> items</strong></a></td>
</tr>
</table></td>
</tr>
<tr>
<form action="[Link]" method="get" name="king">
<td width="24%" align="left" valign="middle" style="padding-
left:20px;"><strong>Search :</strong>
<input type="text" name="keyword" value="<?php echo
$_GET['keyword'];?>" /></td>
<td width="7%" align="left" valign="middle"><input
type="image" src="images/go_botton.gif" width="50" height="23"
onClick="return searchvalid();" /></td>
</form>
</tr>
</table></td>
</tr>
<tr> <?php if($_SESSION['compuserid']=="") { ?>
<a href="[Link]" class="menu7">Contact
us </a>
<?php } else { ?>
<a href="[Link]" class="menu7">Logout </a>
<?php } ?>
</td>
</tr>
</table>
<a href="[Link]" class="menu7"> </a> </td>
</tr>
<tr>
<td align="left" valign="top" style="padding-top:10px;"><table
width="100%" border="0" cellspacing=" 0" cellpadding="0">
<tr>
<td width="75%" align="left" valign="top"><table width="129%"
border="0" align="center" cellpadding="0" cellspacing=" 0">
<tr>
<td width="1%" align="left" valign="top"><img
src="images/flash_td_top_left.gif" width="6" height="6" /></td>
<td width="98%" align="left" valign="top"
background="images/flash_td_top_spacer.gif"> </td>
<td width="1%" align="left" valign="top"><img
src="images/flash_td_top_right.gif" width="6" height="6" /></td>
</tr>
<tr>
<td align="left" valign="top"
background="images/flash_td_left_spacer.gif"> </td>
<td align="left" valign="top"></td>
<td align="left" valign="top"
background="images/flash_td_right_spacer.gif"> </td>
</tr>
<tr>
<td align="left" valign="top"><img
src="images/flash_td_bottom_left.gif" width="6" height="6" /></td>
<td align="left" valign="top"
background="images/flash_td_bottom_spacer.gif"></td>
<td align="left" valign="top"><img
src="images/flash_td_bottom_right.gif" width="6" height="6" /></td>
</tr>
</table></td>
<td width="25%" align="left" valign="top"><table width="100%"
border="0" cellspacing=" 0" cellpadding="0">
<tr>
<td align="center" valign="middle"><a href="#"></a></td>
</tr>
<tr>
<td height="5" align="center" valign="middle"> </td>
</tr>
<tr>
<td align="center" valign="middle"><a href="#"></a></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>