<?php
require_once("admin/Database.php");
require_once("admin/class.pager.php");

$p = new Pager;
$db = new Database();
$results = array();


$id = $_GET['id'];
$limit = 10;
$start = $p->findStart($limit);

$query = "select * from research_articles where journal_id='$id'";
$db->query($query);
$count = $db->get_num_rows();

$pages = $p->findPages($count, $limit);

$query = "select * from research_articles where journal_id='$id' order by article_id desc LIMIT ".$start.", ".$limit;

if($db->query($query)&&$db->get_num_rows()>0)
{
	for($a=0;$a<$db->get_num_rows();$a++)
	{
		$row = $db->fetch_row();
		for($b=0;$b<count($row);$b++)
		{
			$row[$b]= stripslashes($row[$b]);
		}
		array_push($results,$row);
	}
}
if($pages>1)
$pagelist = $p->pageList($_GET['page'], $pages,$id);
else 
$pagelist = "";
require 'Smarty.class.php';
$smarty = new Smarty;
$smarty->assign("pagelist",$pagelist);
$smarty->assign('results',$results);
$smarty->display('american_journal_of_gastroentrology.tpl');
?>