Pereiti prie turinio

Rekomenduojami pranešimai

Kaip padaryti kad butu ne "Prev 1 2 3 4 5 6 7 8 9 10 11 12 Next", o "Prev 1 2 3 4 5 6 ... 12 Next" :)

 

$per_page = 1;
$start = $_GET['start'];
$record_count = mysql_num_rows(mysql_query("SELECT * FROM CHARACTER_SETS"));
$max_pages = $record_count / $per_page;
if(!$start)
$start = 0;
$get = mysql_query("SELECT * FROM CHARACTER_SETS LIMIT $start, $per_page");
while($row = mysql_fetch_assoc($get))
{
$xx = $row['CHARACTER_SET_NAME'];
$yy = $row['DEFAULT_COLLATE_NAME'];
echo $xx." "."<font color='red'>[$yy]</font>"."<br>";
}

$prev = $start - $per_page;
$next = $start + $per_page;

//show prev button
if(!($start<=0))
echo "<a href='index.php?start=$prev'>Prev</a>";

echo " << ";

//show page numbers
$i = 1;
for($x=0;$x<$record_count;$x=$x+$per_page)
{
if($start!=$x)	
echo "<a href='index.php?start=$x'> $i </a>";
else
echo "<a href='index.php?start=$x'><font color='red'> $i </font></a>";
$i++;
}

echo " >> ";

//show next button
if(!($start>=$record_count-$per_page))
echo "<a href='index.php?start=$next'>Next</a>";

Nuoroda į pranešimą
Dalintis kituose puslapiuose
$per_page = 1;
$start = $_GET['start'];
$record_count = mysql_num_rows(mysql_query("SELECT * FROM CHARACTER_SETS"));
$max_pages = $record_count / $per_page;
if(!$start)
$start = 0;
$get = mysql_query("SELECT * FROM CHARACTER_SETS LIMIT $start, $per_page");
while($row = mysql_fetch_assoc($get))
{
$xx = $row['CHARACTER_SET_NAME'];
$yy = $row['DEFAULT_COLLATE_NAME'];
echo $xx." "."<font color='red'>[$yy]</font>"."<br>";
}

$prev = $start - $per_page;
$next = $start + $per_page;

//show prev button
if(!($start<=0))
echo "<a href='index.php?start=$prev'>Prev</a>";

echo " << ";

//show page numbers
$i = 1;
for($x=0;$x<$record_count;$x=$x+$per_page)
{
if($start==$x)
{
echo "<a href='test.php?start=$x'><font color='red'> $i </font></a>";
}
else
{
if(($start - $x)  < 4 && ($x - $start)  < 4 )
{
	echo "<a href='test.php?start=$x'> $i </a>";
}
else if($x == 0)
{
	echo "<a href='test.php?start=$x'> $i </a>...";
}
else if($x == $record_count-1)
{
	echo "...<a href='test.php?start=$x'> $i </a>";
}
}
$i++;
}

echo " >> ";

Nuoroda į pranešimą
Dalintis kituose puslapiuose

Prisijunkite prie diskusijos

Jūs galite rašyti dabar, o registruotis vėliau. Jeigu turite paskyrą, prisijunkite dabar, kad rašytumėte iš savo paskyros.

Svečias
Parašykite atsakymą...

×   Įdėta kaip raiškusis tekstas.   Atkurti formatavimą

  Only 75 emoji are allowed.

×   Nuorodos turinys įdėtas automatiškai.   Rodyti kaip įprastą nuorodą

×   Jūsų anksčiau įrašytas turinys buvo atkurtas.   Išvalyti redaktorių

×   You cannot paste images directly. Upload or insert images from URL.

Įkraunama...
  • Dabar naršo   0 narių

    Nei vienas registruotas narys šiuo metu nežiūri šio puslapio.

×
×
  • Pasirinkite naujai kuriamo turinio tipą...