begin_frame("Navigacija");
$previd = SQL_Query_exec("SELECT id, name,image1 FROM torrents WHERE image1 AND id < $id ORDER BY id DESC LIMIT 1");
$prev = mysql_fetch_row($previd);
$previd = $prev[0];
$prevname = htmlspecialchars($prev[1]);
$image = $prev[2];
$nextid = SQL_Query_exec("SELECT id, name,image1 FROM torrents WHERE image1 AND id > $id ORDER BY id ASC LIMIT 1");
$next = mysql_fetch_row($nextid);
$nextid = $next[0];
$nextname = htmlspecialchars($next[1]);
$image2 = $next[2];
echo "<table border=0 width=100%><tr>";
if ($previd) echo "<td align=center>Nazaj: <a href='torrents-details.php?id=$previd'><img border=0 src=".$site_config['SITEURL']."/uploads/images/".$image." width=50 height=70><BR>$prevname</a></td>";
if ($nextid) echo "<td align=center>Naprej: <a href='torrents-details.php?id=$nextid'><img border=0 src=".$site_config['SITEURL']."/uploads/images/".$image2." width=50 height=70><BR>$nextname</a></td>";
echo "</tr></table>";
end_frame();