Please visit the site 1st
site is here
look at the index page content below the sentence "below content will come from database"
a pragraph there and below the paragraph there is
pages 1,2
if i click page 2 the page appera with the text " paragraph 2 for index page (page2)is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been ....bla bla bla..."
thats mean pagination happens sucessfully and the index page url is
?id=1
But in the button apple i also insertes two pages page 1 is showing but after clicking the page 2... it goes to the index page's 2
here is my full code
<?php mysql_connect('mysql2', 'pegu', 'segu') or die('Connection Failed');
mysql_select_db('legu') or die('Database not found');
$iDefaultRecord = 1;
$id = isset($_GET['id']) ? filter_var($_GET['id'], FILTER_VALIDATE_INT) : $iDefaultRecord;
$result = mysql_query("SELECT title, dtl, meta_d, meta_k FROM page WHERE id=$id");
if (!mysql_num_rows($result)) { header('Location: 404.php', true, 404); die();}$row = mysql_fetch_array($result);$title = stripslashes($row['title']);$dtl = stripslashes($row['dtl']);$meta_d = stripslashes($row['meta_d']);$meta_k = stripslashes($row['meta_k']);
$pages = explode("{newpage}", $dtl);
if(isset($_GET['page']) && $_GET['page'] > 0)
{
$current_page = $_GET['page'];
if($current_page > count($pages))
{
$current_page = count($pages);
}
}
else
{
$current_page = 1;
}
$description = $pages[$current_page - 1];
$navigation = "Pages: ";
for ($i = 1; $i <= count($pages); $i++)
{
if($i == $current_page)
{
$navigation .= "<b>";
}
$navigation .= "<a href='?page=" . $i . "'> " . $i . "</a> ";
if($i == $current_page)
{
$navigation .= "</b>";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="keywords" content="<?php echo $meta_k; ?>" />
<meta name="description" content="<?php echo $meta_d; ?>" />
<title><?php echo $title; ?></title>
<link rel="stylesheet" href="cssReset.css" />
<link rel="stylesheet" href="style.css" />
<style type="text/css">
img, div, a, li, span{behavior:url(iepngfix.htc);}
</style>
</head>
<body>
<div id="top">
<div id="banner">
<h1><a href="#">Environmental.com</a> <span>site slogan here</span></h1>
</div>
<p id="help">Help Line 24 /7 Support 1800 3246 345</p>
<div id="nav">
<ul>
<li><a href="?id=1" class="pageitem">index</a></li>
<li><a href="?id=2" class="pageitem">apple</a></li>
<li><a href="?id=3" class="pageitem">banana</a></li>
<li><a href="?id=4" class="pageitem active">orange</a></li>
<li><a href="?id=5" class="pageitem">lemon</a></li>
<li><a href="?id=6" class="pageitem">nut</a></li>
</ul>
<div style="clear:both"></div>
</div><!--end of navigation-->
<div id="glow">
</div>
<div style="clear:both"></div>
</div><!-- end of top-->
<div style="clear:both"></div>
<div id="content">
<div id="left">
<div id="box1">
<img src="Images/hand.png" alt="Hand" />
<h3>below content will come from database</h3>
<?php echo $description; ?>
<p><?php echo $navigation;?></p>
</div><!-- end of box1-->
<div style="clear:both"></div>
<!-- end of box2-->
<div style="clear:both"></div>
<!-- end of box3-->
<div style="clear:both"></div>
<div id="read">
</div>
</div><!-- end of left div-->
<div id="right">
</div>
</div><!-- end of right div-->
<div style="clear:both"></div>
</div><!-- end of content-->
<div style="clear:both"></div>
<div id="footer">
</div><!-- end of footer-->
</body>
</html>
Help


















