Digital World Freelancer

The Digital World Freelancer group is applying latest Technologies Like HTML, CSS, CSS3, JavaScript, JQuery, PHP and more...... for website designing & developing... reach at our organization http://www.digitalworldfreelancer.com

Facebook Page

Sunday, October 2, 2016

How do active page on pagination

please try this...

 echo "<li if($_GET['page']==$i){ class='active'}><a href='topics.php?page=".$i."'>".$i."</a></li> ";

Pagination in Core Php code

<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>



Online Voting System in PHP & MySQLi

Online voting or online poll system.....

click on above link for know more...

Geolocation Google link

Geolocation working in Crome also...

<!DOCTYPE html>
<html>
  <head>
    <title>Geolocation</title>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <style>
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
      }
      #map {
        height: 100%;
      }
    </style>
  </head>
  <body>
    <div id="map"></div>
    <script>
      // Note: This example requires that you consent to location sharing when
      // prompted by your browser. If you see the error "The Geolocation service
      // failed.", it means you probably did not give permission for the browser to
      // locate you.

      function initMap() {
        var map = new google.maps.Map(document.getElementById('map'), {
          center: {lat: -34.397, lng: 150.644},
          zoom: 6
        });
        var infoWindow = new google.maps.InfoWindow({map: map});

        // Try HTML5 geolocation.
        if (navigator.geolocation) {
          navigator.geolocation.getCurrentPosition(function(position) {
            var pos = {
              lat: position.coords.latitude,
              lng: position.coords.longitude
            };

            infoWindow.setPosition(pos);
            infoWindow.setContent('Location found.');
            map.setCenter(pos);
          }, function() {
            handleLocationError(true, infoWindow, map.getCenter());
          });
        } else {
          // Browser doesn't support Geolocation
          handleLocationError(false, infoWindow, map.getCenter());
        }
      }

      function handleLocationError(browserHasGeolocation, infoWindow, pos) {
        infoWindow.setPosition(pos);
        infoWindow.setContent(browserHasGeolocation ?
                              'Error: The Geolocation service failed.' :
                              'Error: Your browser doesn\'t support geolocation.');
      }
    </script>
    <script async defer
    src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap">
    </script>
  </body>
</html>