|
[ Autoren gesucht! ]
|
PHP-Homepage.de sucht laufend Autoren für News und Artikel
Interesse?
|
|
 |
|
[Start] [Suche] [Neue Einträge]
| Buttonmaker für Datenbankanfrage | <?
/*
Filename : demoBrowsDB.php3
This little Script build the prev- , Pages- and next- Button
see it in action at http://www.it-development.de
if you have an questions : Bernhard Bauder
bbauder@it-development.de
Have fun.
Berni
2.01.2001
change the Link Filename : news.php to match your Filename
Link 44,52,59
After you are finished, just print the $Button vaiable
Have fun
Your Selectstatement
*/
$Select= "select count(*) from itnews where newsAktiv ='1'";
$MaxRow=10;
if (!isset($CR))
{
$result = mysql_query($Select) or die ( "Datenbankfehler1! versuchen Sie es erneut");
$row=mysql_fetch_row($result);
$CR=$row[0];
$RL=0;
}
$AnzahlSeiten=intval($CR/$MaxRow);
if ($AnzahlSeiten < ($CR/$MaxRow))
{
$AnzahlSeiten++;
}
$text= "<BR>Seite :";
// check for Prevbutton
if ($RL > 0)
{
$y=$RL-$MaxRow;
$Button.= "<a href=\"news.php3?CR=$CR&RL=$y\">-</a> ";
}
for ($i = 1; $i <= $AnzahlSeiten; $i++)
{ $y=($i*$MaxRow)-$MaxRow;
if ($y==$RL){$Button.= "<B>";}
$Button.= "[<a href=\"news.php3?CR=$CR&RL=$y\">$i</a>] ";
if ($y==$RL){$Button.= "</B>";}
}
// check for Nextbutton
if ($RL < ($CR-$MaxRow)) {
$y=$RL+$MaxRow;
$Button.= "<a href=\"news.php3?CR=$CR&RL=$y\">+</a> ";
}
?> |
|