MSV FM

dot.antimicrobial@66.96.161.157: ~ $
Path : /hermes/bosweb/b1705/trinix19.ipage.com/Backup/sharol/LatestNews/
File Upload :
Current < : /hermes/bosweb/b1705/trinix19.ipage.com/Backup/sharol/LatestNews/data.php

 <style>
#imgbox{
	    max-width: 170px;
    border: 1px solid black;
}
</style>

<?php 
	require 'connection.php';

    // Variables for the first page hit
	$start = 0;
	$page_counter = 0;
    $per_page = 5;
    $next = $page_counter + 1;
    $previous = $page_counter - 1;

    // Check the page location with start value sent by get request and change variable values accordingly
	if(isset($_GET['start'])){
		$start = $_GET['start'];
		$page_counter =  $_GET['start'];
		$start = $start *  $per_page;
		$next = $page_counter + 1;
		$previous = $page_counter - 1;
	}

	//placeholder variable to store result
	$result = null;
   
   // query to get messages from messages table
	$query =mysql_query("SELECT * FROM news_post ORDER BY `id` DESC LIMIT $start, $per_page") or die(mysql_error());
	while($row = mysql_fetch_array($query)){
			    // store each row in result variable 
				$body=(strlen($row[4])>200)?substr($row[4],0,300).'....<a href="main.php?id='.$row[0].'" style="color:blue;"><i class="fa fa-hand-o-up"></i>Know More</a>':$row[4];
				$result[] = '<div class="pull-left" style="padding-right:5%;"><img src="data:image/jpeg;base64,'.base64_encode( $row[2] ).'" width="100px" height="100px" class="img-responsive"/></div><div class="pull-right" style="font-size:12px; color:red;">'.$row['date'].'</div> <a  style="color:blue; font-size:18px;">'.$row['subject']."</a> <br><p> ".$body.'</p>';
		}
		
  // query to get total number of rows in messages table
	$count_query =mysql_query("SELECT * FROM news_post");
	$count = mysql_num_rows($count_query);
    
    // calculate number of paginations required based on row count 
	$paginations = ceil($count / $per_page);


?>