Autor Zpráva
nesfiheer
Profil *
Mám skript len neviem ako na stránkovania... PROSÍM o pomoc, skúsal som uz aj podla návodu falcona, ale mam z toho spanielsku dedinu

<table border="1" cellspacing="0" cellpadding="0" bordercolor="#000000">
<tr>
<td colspan="3" align="right">
<a href="addTopic.php">Pridať servisný zásah</a>
</td>
</tr>
<tr class="head">
<td width="75" align="center">Číslo zásahu</td>
<td width="400" >Pracovník</td>
<td width="75" align="center">Dátum</td>

</tr>

<?
//include file for the wrapperclass
include "wrapperclass.php";

//make an object of the wrapperclass
$forum=new ForumInterface();

//make db connection
$forumpointer=$forum->connect();

//insert record
$rs = $forum->getTopics();

while ($row=mysql_fetch_assoc($rs))
{

?>

<tr class="main">
<td align="center"><? echo($row['ID']); ?></td>
<td >
<a style="margin-left: 7px" href='theTopic.php?id=<? echo($row['ID']); ?>'>
<? echo($row['pracovnik']); ?>
</a>
</td>
<td align="center"><? echo($row['datum']); ?></td>

</tr>


<?
}

//disconnect to db
$forum->Disconnect($forumpointer);

?>
</table>
peta
Profil
To mas asi jen 5% nejakeho scriptu. Do toho ti nikdo nic doplnovat nebude.

Strankovani se dela tak, ze si z databaze vytahnes pocet pres
"SELECT COUNT(sloupec) FROM tabulka"
A pak dotaz pro zobrazeni zaznamu omezis LIMITY
"SELECT * FROM tabulka LIMIT $a,$b"
A ty $a a $b si musis vypocitat z celkoveho poctu a z toho, co si nastavujes do $_SESSION nebo do promennych z predchoziho listovani.

Jestli neovladas PHP a SQL, tak to budes mit fakt tezky
Ja mam treba jednoduchy script pro zobrazeni navigace (k tomu musis pridat scripty pro ty 2 SELECT a ukladani promennych strankovani)


function PPnav1($where,$Xfrom,$Xcount,$Xfound,$add)

{if ($Xfound>0) {

// global $Slink;

// |< << < 4/20 > >> >|

// a b c x y d e f

$d = array();

$title = array();

$hide = array();

$zn = array("","|<","<<","<",">",">>",">|");

$x = floor($Xfrom / $Xcount);

$y = ceil($Xfound / $Xcount); //ne++

$a=1; $d[$a] = 1; $hide[$a] = $y<=1 ? 1 : 0; //ne++

$a=6; $d[$a] = $y; $hide[$a] = $y<=1 ? 1 : 0; //ne++

$n = ceil($y/10)<<1;

$a=3; $d[$a] = $x-1; $hide[$a] = $d[$a]< $d[1]-1 ? 1 : 0;

$a=2; $d[$a] = $d[3]-$n;$hide[$a] = $d[$a]< $d[1]-1 ? 1 : 0;

$a=4; $d[$a] = $x+1; $hide[$a] = $d[$a]>=$d[6]-1 ? 1 : 0;

$a=5; $d[$a] = $d[4]+$n;$hide[$a] = $d[$a]>=$d[6]-1 ? 1 : 0;

$a=1; $d[$a]--;

$a=6; $d[$a]--;

ksort($hide);

//ksort($d);print_r($d);



//$t2=$add.($add!==""?"&amp;":"").'count='.$Xcount.'&amp;from=';

$t =" <p align="center" class="arrownav">";

$a=0;

foreach($hide as $key => $value)

{

$a+=$value;

$z = HTMLSpecialChars($zn[$key]);

$t2= array();

if ($add!=="") {$t2[]=$add;}

$t2[]="count=".$Xcount;

$t2[]="from=".(($d[$key]*$Xcount)+1);

if ($value===1) {$t.=" <span>$z</span>";}

else {$t.=" ".html_link($where,$t2,$z,$d[$key]+1);}

if ($key==3) {$t.=" ".($x+1)." / $y";}

}

$t.=" </p>";

if ($a==6) {$t="";}

return $t;

}}

je to naprosto primitivni script pro zobrazeni
|< << < 5/7 > >> >|
Co nepotrebuje, ze sipek, ty nezobrazi.
Asi by to chtelo vymyslet neco lepsiho, univerzalniho.
Toto téma je uzamčeno. Odpověď nelze zaslat.