znam da se može mnogo elegantnije odraditi, davno sam kucao i ovo mi je jedna od prvih skripti, ali može da posluži:
Code:
<?
$limit=$_GET['limit'];
$id=$_GET['id'];
?>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<?
for ($n=1; $n<=3; $n++) /* broj redova */
{
?>
<tr height="130">
<?
$sql1="select * from $table_pictures2 where categoryid=$id limit $limit, 3";
$result1=mysql_query($sql1) or die ("<div align=\"center\" class=\"font_red_bold\">Greška prilikom izvlačenja slike iz baze: ".mysql_error()."</div>");
while (list($id, $categoryid, $name, $description, $size, $sender, $date, $voters, $votes, $image, $type, $rand, $template)=mysql_fetch_row($result1))
{
?>
<td align="center" class="font_black10" valign="center" style="border-style: dashed; border-color:#CCCCCC; border-width: 1; padding: 0; background-color: ##EFEFEF" align="center">
<br>
<a href="show.php?action=show&id=<?= $id?>" target="_blank"><img src="image.php?id=<?= $id ?>&template=yes" border="0"></a>
</br>Veličina: <? $size=(int)($size/1024); print $size; ?> KB</br><br>
</td>
<?
$td++;
if ($td=="1" or $td=="2")
{
?>
<td width="5"></td>
<?
}
}
?>
</tr>
<tr>
<td align="center" valign="top" colspan="10"><BR></td>
</tr>
<?
$td=0;
$limit+=3;
$id=$_GET['id'];
$sql10="select count(*) as max from $table_pictures2 where categoryid=$id";
$resultsql10=mysql_fetch_array(mysql_query($sql10));
if (($limit)>=$resultsql10[max]) break;
}
?>
</table>
<table width="90%" align="center">
<tr>
<td align="left" valign="top" width="33%" class="font_black_bold">
<?
if ($_GET['limit']>0)
{
$newlimit=$_GET[limit]-9;
?>
<<<
<a href="category.php?limit=<?= $newlimit ?>&id=<?= $id ?>" class="font_red_bold">Prethodna strana</a>
<?
}
?>
</td>
<td align="center"><a href="index.php" class="font_red_bold">Početna strana</a>
</td>
<td valign="top" align="right" width="33%" class="font_black_bold">
<?
$sql2="select count(*) as max from $table_pictures2 where categoryid=$id";
$resultsql2=mysql_fetch_array(mysql_query($sql2));
if (($limit)<$resultsql2[max])
{
$newlimit=$_GET[limit]+9;
?>
<a href="category.php?limit=<?= $newlimit ?>&id=<?= $id ?>" class="font_red_bold">Sledeća strana</a> >>>
<?
}
?>
</td>
</tr>
</table>