$types = array();
$result = dbquery("SELECT DISTINCT type FROM ".DB_PREFIX."type");
while (list($type) = dbarraynum($result)):
$types[] = $type;
endwhile;
$a = $b = array();
foreach ($types as $key=>$value) {$a[] = $value; $b[] = 0;}
$types = array_combine($a, $b);
$id = $type = array();
$result = dbquery("SELECT id, type FROM ".DB_PREFIX."type ORDER BY id ASC");
while (list($key, $value) = dbarraynum($result)):
$types[$value]++;
if (array_key_exists($value, $types) and $types[$value] <= 2) {
$id[] = $key;
$type[] = $value;
}
endwhile;
$per_page = 2; // Кол-во на страницу
$array = array_combine($id, $type);
$pages = array_chunk($array, $per_page, TRUE);
if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) { $_GET['rowstart'] = 0; }
foreach ($pages[$_GET['rowstart']] as $key=>$value) echo $key.' - '.$value.'
';
echo "