<div class="about_top">
<div class="container">
<div class="about">
<div class="col-md-12">
<h3 class="m_3">Our Blog</h3>
<div class="col-md-12 col-sm-12 blog-left main">
<?php
$num_rec_per_page=3;
if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * $num_rec_per_page;
$query = "select * from blog ORDER BY sno DESC LIMIT $start_from, $num_rec_per_page";
$query1 = mysql_query($query);
while($sql=mysql_fetch_array($query1))
{
echo '<div class="main">';
echo '<h2 class="title">'.$sql['title'].'</h2>';
echo '</div>';
echo '<ul class="col-md-12">';
echo '<li><p> Post By: '.$sql['name'].'</p></li>';
echo '<li><p> Date: '.$sql['date'].'</p></li>';
echo '<li><p> Comments: '.$sql['comments'].'</p></li>';
echo '</ul>';
echo '<div class="col-md-4 blog-one-left">';
echo "<img src='".getBaseUrl()."admin/images/".rawurlencode($sql['image'])."' width='250' height='150'>";
echo '</div>';
echo '<div class="col-md-8 blog-one-left">';
echo '<p>'.$sql['description'].'</p>';
echo '<br/>';
echo '<br/>';
echo '<a href="single.php?id='.$sql['sno'].'"><span class="btn btn-info" style="float:right;font:12px arial;">Read More</span></a>';
echo '<br/><br/><br/>';
echo '</div>';
}
?>
<div class="pagination pagination-centered">
<ul>
<?php
$sql = "select * from blog";
$rs_result = mysql_query($sql); //run the query
$total_records = mysql_num_rows($rs_result); //count number of records
$total_pages = ceil($total_records / $num_rec_per_page);
echo "<li><a href='blog.php?page=1'>".'First'."</a></li> "; // Goto 1st page
for ($i=1; $i<=$total_pages; $i++)
{
echo "<li><a href='blog.php?page=".$i."'>".$i."</a> </li>";
};
echo "<li><a href='blog.php?page=$total_pages'>".'Last'."</a></li> "; // Goto last page
?>
</ul>
</div>
</div>
<div class="clearfix"> </div>
</div>
<div class="clearfix"> </div>
</div>
<div class="container">
<div class="about">
<div class="col-md-12">
<h3 class="m_3">Our Blog</h3>
<div class="col-md-12 col-sm-12 blog-left main">
<?php
$num_rec_per_page=3;
if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * $num_rec_per_page;
$query = "select * from blog ORDER BY sno DESC LIMIT $start_from, $num_rec_per_page";
$query1 = mysql_query($query);
while($sql=mysql_fetch_array($query1))
{
echo '<div class="main">';
echo '<h2 class="title">'.$sql['title'].'</h2>';
echo '</div>';
echo '<ul class="col-md-12">';
echo '<li><p> Post By: '.$sql['name'].'</p></li>';
echo '<li><p> Date: '.$sql['date'].'</p></li>';
echo '<li><p> Comments: '.$sql['comments'].'</p></li>';
echo '</ul>';
echo '<div class="col-md-4 blog-one-left">';
echo "<img src='".getBaseUrl()."admin/images/".rawurlencode($sql['image'])."' width='250' height='150'>";
echo '</div>';
echo '<div class="col-md-8 blog-one-left">';
echo '<p>'.$sql['description'].'</p>';
echo '<br/>';
echo '<br/>';
echo '<a href="single.php?id='.$sql['sno'].'"><span class="btn btn-info" style="float:right;font:12px arial;">Read More</span></a>';
echo '<br/><br/><br/>';
echo '</div>';
}
?>
<div class="pagination pagination-centered">
<ul>
<?php
$sql = "select * from blog";
$rs_result = mysql_query($sql); //run the query
$total_records = mysql_num_rows($rs_result); //count number of records
$total_pages = ceil($total_records / $num_rec_per_page);
echo "<li><a href='blog.php?page=1'>".'First'."</a></li> "; // Goto 1st page
for ($i=1; $i<=$total_pages; $i++)
{
echo "<li><a href='blog.php?page=".$i."'>".$i."</a> </li>";
};
echo "<li><a href='blog.php?page=$total_pages'>".'Last'."</a></li> "; // Goto last page
?>
</ul>
</div>
</div>
<div class="clearfix"> </div>
</div>
<div class="clearfix"> </div>
</div>
No comments:
Post a Comment